auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>protected AccumulationAnnotatedTypeFactory( BaseTypeChecker checker, Class<? extends Annotation> accumulator, Class<? extends Annotation> bottom) { super(checker); this.accumulator = accumulator; Method[] accDeclaredMethods = accumulator.getDeclaredMethods(); if (accDeclaredMethods.length != 1) { <START> rejectMalformedAccumulator("not have more than one argument"); <END> } Method value = accDeclaredMethods[0]; if (value.getName() != "value") { rejectMalformedAccumulator("name its argument \"value\""); } if (!value.getReturnType().isInstance(new String[0])) { rejectMalformedAccumulator("have an argument of type String[]"); } if (((String[]) value.getDefaultValue()).length != 0) { rejectMalformedAccumulator("must have the empty string array as its default value"); } this.bottom = AnnotationBuilder.fromClass(elements, bottom); this.top = createAccumulatorAnnotation(Collections.emptyList()); if (this.getClass() == AccumulationAnnotatedTypeFactory.class) { this.postInit(); } }</code><technical_language>"argument" "element". test fails if zero elements, message misleading</technical_language>

Target:
protected AccumulationAnnotatedTypeFactory( BaseTypeChecker checker, Class<? extends Annotation> accumulator, Class<? extends Annotation> bottom) { super(checker); this.accumulator = accumulator; Method[] accDeclaredMethods = accumulator.getDeclaredMethods(); if (accDeclaredMethods.length != 1) { rejectMalformedAccumulator("have exactly one element"); } Method value = accDeclaredMethods[0]; if (value.getName() != "value") { rejectMalformedAccumulator("name its element \"value\""); } if (!value.getReturnType().isInstance(new String[0])) { rejectMalformedAccumulator("have an element of type String[]"); } if (((String[]) value.getDefaultValue()).length != 0) { rejectMalformedAccumulator("have the empty String array as its default value"); } this.bottom = AnnotationBuilder.fromClass(elements, bottom); this.top = createAccumulatorAnnotation(Collections.emptyList()); if (this.getClass() == AccumulationAnnotatedTypeFactory.class) { this.postInit(); } }
Source:
<code>private void initializeScrollPanel(final Screen screen) { if (horizontalScrollbar == ScrollbarMode.off || horizontalScrollbar == ScrollbarMode.optional) { Element horizontal = getElement().findElementByName("#horizontal-scrollbar-parent"); if (horizontal != null) { nifty.removeElement(screen, horizontal); } } if (verticalScrollbar == ScrollbarMode.off || verticalScrollbar == ScrollbarMode.optional) { Element vertical = getElement().findElementByName("#vertical-scrollbar"); if (vertical != null) { nifty.removeElement(screen, vertical); } } childRootElement.setConstraintX(new SizeValue("0px")); childRootElement.setConstraintY(new SizeValue("0px")); updateBottomRightElement(); <START> } <END></code><technical_language>hurt performance much? I this needed in some circumstances. I remember lines break some stuff eventually missing :) else pretty good! I get lines eventually</technical_language>

Target:
private void initializeScrollPanel(final Screen screen) { if (horizontalScrollbar == ScrollbarMode.off || horizontalScrollbar == ScrollbarMode.optional) { Element horizontal = getElement().findElementByName("#horizontal-scrollbar-parent"); if (horizontal != null) { nifty.removeElement(screen, horizontal); } } if (verticalScrollbar == ScrollbarMode.off || verticalScrollbar == ScrollbarMode.optional) { Element vertical = getElement().findElementByName("#vertical-scrollbar"); if (vertical != null) { nifty.removeElement(screen, vertical); } } childRootElement.setConstraintX(new SizeValue("0px")); childRootElement.setConstraintY(new SizeValue("0px")); updateBottomRightElement(); nifty.executeEndOfFrameElementActions(); getElement().getParent().layoutElements(); }
Source:
<code>protected boolean ensureDependencies(KieModule module) { POM projectPom = module.getPom(); Dependencies dependencies = projectPom.getDependencies(); String kieVersion = props.getProperty(KIE_VERSION); boolean toSave = false; Path modulePomXMLPath = module.getPomXMLPath(); for (GAV oldDependency : getOldDependencies()) { toSave |= removeFromPomIfNecessary(dependencies, oldDependency); } <START> boolean activatorToRecreate = toSave; <END> for (GAV gav : getDependencies(kieVersion)) { toSave |= editPomIfNecessary(dependencies, gav); } if (toSave) { pomService.save(modulePomXMLPath, projectPom, null, ""); } return activatorToRecreate; }</code><technical_language>Related single responsibility of method. I in this method name variable independently activator. I is side effect remove activator change of dependencies. do think</technical_language>

Target:
protected boolean ensureDependencies(KieModule module) { POM projectPom = module.getPom(); Dependencies dependencies = projectPom.getDependencies(); String kieVersion = props.getProperty(KIE_VERSION); boolean toSave = false; Path modulePomXMLPath = module.getPomXMLPath(); for (GAV oldDependency : getOldDependencies()) { toSave |= removeFromPomIfNecessary(dependencies, oldDependency); } boolean oldDependenciesExist = toSave; for (GAV gav : getDependencies(kieVersion)) { toSave |= editPomIfNecessary(dependencies, gav); } if (toSave) { pomService.save(modulePomXMLPath, projectPom, null, ""); } return oldDependenciesExist; }
Source:
<code><START> public void setState(final Map<String, Object> loadedState) throws IOException, ClassNotFoundException { <END> applyStatefulFunction.setFunctionState(loadedState.get("applyStatefulFunctionState")); }</code><technical_language>remove throws</technical_language>

Target:
public void setState(final Map<String, Object> loadedState) { applyStatefulFunction.setFunctionState(loadedState.get("applyStatefulFunctionState")); }
Source:
<code>private CompletableFuture<List<TableDescriptor>> listTables(Optional<Pattern> tableNamePattern) { CompletableFuture<List<CompletableFuture<Table>>> futureTables = bigtableTableAdminClient.listTablesAsync().thenApply(r -> r.stream() .filter(t -> !tableNamePattern.isPresent() || tableNamePattern.get().matcher(t).matches()) .map(q -> bigtableTableAdminClient.getTableAsync(q) .exceptionally(ex -> { LOG.error("Error while fetching Table", ex); return null; <START> })) <END> .collect(Collectors.toList())); return futureTables .thenCompose(s -> CompletableFuture.allOf(s.toArray(new CompletableFuture[0])) .thenApply(v -> s.stream() .map(CompletableFuture::join) .filter(Objects::nonNull) .map(tableAdapter2x::adapt) .collect(Collectors.toList()))); }</code><technical_language>This masks a legitimate error. do this. need fix underlying problem is</technical_language>

Target:
private CompletableFuture<List<TableDescriptor>> listTables(Optional<Pattern> tableNamePattern) { return bigtableTableAdminClient.listTablesAsync() .thenApply(r -> r.stream() .filter(t -> !tableNamePattern.isPresent() || tableNamePattern.get().matcher(t).matches()) .map(m -> com.google.bigtable.admin.v2.Table.newBuilder() .setName(bigtableInstanceName.toTableNameStr(m)) .build()) .map(Table::fromProto) .map(tableAdapter2x::adapt) .collect(Collectors.toList())); }
Source:
<code><START> public static void checkPrefixesForDuplicatesAndShadowing( <END> final List<String> prefixes ) { for (int i = 0; i < prefixes.size(); i++) { String prefix1 = prefixes.get(i); for (int k = 0; k < prefixes.size(); k++) { if (i != k) { String otherPrefix = prefixes.get(k); if (prefix1.equals(otherPrefix)) { throw new IAE("Detected duplicate prefix in join clauses: [%s]", prefix1); } if (isPrefixedBy(prefix1, otherPrefix)) { throw new IAE("Detected conflicting prefixes in join clauses: [%s, %s]", prefix1, otherPrefix); } } } } }</code><technical_language>suggestion private static void checkPrefixesForDuplicatesAndShadowing(</technical_language>

Target:
public static void checkPrefixesForDuplicatesAndShadowing( final List<String> prefixes ) { prefixes.sort(DESCENDING_LENGTH_STRING_COMPARATOR); for (int i = 0; i < prefixes.size(); i++) { String prefix = prefixes.get(i); for (int k = i + 1; k < prefixes.size(); k++) { String otherPrefix = prefixes.get(k); if (prefix.equals(otherPrefix)) { throw new IAE("Detected duplicate prefix in join clauses: [%s]", prefix); } if (isPrefixedBy(prefix, otherPrefix)) { throw new IAE("Detected conflicting prefixes in join clauses: [%s, %s]", prefix, otherPrefix); } } } }
Source:
<code>public static void setupClasspath( final Path distributedClassPath, final Path intermediateClassPath, final Job job ) throws IOException { String classpathProperty = System.getProperty("druid.hadoop.internal.classpath"); if (classpathProperty == null) { classpathProperty = System.getProperty("java.class.path"); } String[] jarFiles = classpathProperty.split(File.pathSeparator); final Configuration conf = job.getConfiguration(); final FileSystem fs = distributedClassPath.getFileSystem(conf); if (fs instanceof LocalFileSystem) { return; } <START> fs.mkdirs(distributedClassPath); <END> for (String jarFilePath : jarFiles) { final File jarFile = new File(jarFilePath); if (jarFile.getName().endsWith(".jar")) { try { RetryUtils.retry( new Callable<Boolean>() { @Override public Boolean call() throws Exception { if (isSnapshot(jarFile)) { addSnapshotJarToClassPath(jarFile, intermediateClassPath, fs, job); } else { addJarToClassPath(jarFile, distributedClassPath, intermediateClassPath, fs, job); } return true; } }, shouldRetryPredicate(), DEFAULT_RETRY_COUNT ); } catch (Exception e) { throw Throwables.propagate(e); } } } }</code><technical_language>this exist before, is this needed now? fs.mkdirs(intermediateClassPath) too</technical_language>

Target:
public static void setupClasspath( final Path distributedClassPath, final Path intermediateClassPath, final Job job ) throws IOException { String classpathProperty = System.getProperty("druid.hadoop.internal.classpath"); if (classpathProperty == null) { classpathProperty = System.getProperty("java.class.path"); } String[] jarFiles = classpathProperty.split(File.pathSeparator); final Configuration conf = job.getConfiguration(); final FileSystem fs = distributedClassPath.getFileSystem(conf); if (fs instanceof LocalFileSystem) { return; } for (String jarFilePath : jarFiles) { final File jarFile = new File(jarFilePath); if (jarFile.getName().endsWith(".jar")) { try { RetryUtils.retry( new Callable<Boolean>() { @Override public Boolean call() throws Exception { if (isSnapshot(jarFile)) { addSnapshotJarToClassPath(jarFile, intermediateClassPath, fs, job); } else { addJarToClassPath(jarFile, distributedClassPath, intermediateClassPath, fs, job); } return true; } }, shouldRetryPredicate(), NUM_RETRIES ); } catch (Exception e) { throw Throwables.propagate(e); } } } }
Source:
<code>public boolean allowReplacement(String currReplState, String replacementReplState){ if ((currReplState == null) || (currReplState.isEmpty())) { return true; } if ((replacementReplState == null) || (replacementReplState.isEmpty())) { return false; } long currReplStateLong = Long.parseLong(currReplState.replaceAll("\\D","")); long replacementReplStateLong = Long.parseLong(replacementReplState.replaceAll("\\D","")); <START> if ((specType == Type.IMPORT) || (specType == Type.BOOTSTRAP_LOAD)) { <END> return (currReplStateLong <= replacementReplStateLong); } else { return (currReplStateLong < replacementReplStateLong); } }</code><technical_language>this is true if table is partitioned</technical_language>

Target:
public boolean allowReplacement(String currReplState, String replacementReplState){ if ((currReplState == null) || (currReplState.isEmpty())) { return true; } if ((replacementReplState == null) || (replacementReplState.isEmpty())) { return false; } long currReplStateLong = Long.parseLong(currReplState.replaceAll("\\D","")); long replacementReplStateLong = Long.parseLong(replacementReplState.replaceAll("\\D","")); if (specType == Type.IMPORT) { return (currReplStateLong <= replacementReplStateLong); } else { return (currReplStateLong < replacementReplStateLong); } }
Source:
<code>public void visit(NodeTraversal t, Node n, Node parent) { if (n.isCall() && n.getChildCount() == 2 && n.getFirstChild().matchesQualifiedName("require") && n.getSecondChild().isString()) { visitRequireCall(t, n, parent); } <START> if (n.isCall() && n.getChildCount() == 3 && n.getFirstChild().isGetProp() && <END> "require.ensure".equals(n.getFirstChild().getQualifiedName()) && n.getSecondChild().isArrayLit() && n.getChildAtIndex(2).isFunction()) { visitRequireEnsureCall(t, n, parent); } if (n.isIf()) { FindModuleExportStatements commonjsFinder = new FindModuleExportStatements(); Node condition = n.getFirstChild(); NodeTraversal.traverseEs6(compiler, condition, commonjsFinder); if (commonjsFinder.isFound()) { visitCommonJSIfStatement(n); } else { FindDefineAmdStatements amdFinder = new FindDefineAmdStatements(); NodeTraversal.traverseEs6(compiler, condition, amdFinder); if (amdFinder.isFound()) { visitAMDIfStatement(n); } } } if (n.isScript()) { scriptNodeCount++; visitScript(t, n); } if (n.isGetProp() && "module.exports".equals(n.getQualifiedName())) { Var v = t.getScope().getVar(MODULE); if (v == null) { moduleExportRefs.add(n); maybeAddReferenceCount(n); } } if (n.isName() && EXPORTS.equals(n.getString())) { Var v = t.getScope().getVar(n.getString()); if (v == null || v.isGlobal()) { exportRefs.add(n); maybeAddReferenceCount(n); } } }</code><technical_language>"&&" next line. Also, check out matchesQualifiedName() in Node</technical_language>

Target:
public void visit(NodeTraversal t, Node n, Node parent) { if (n.isCall() && n.getChildCount() == 2 && n.getFirstChild().matchesQualifiedName("require") && n.getSecondChild().isString()) { visitRequireCall(t, n, parent); } if (n.isCall() && n.getChildCount() == 3 && n.getFirstChild().matchesQualifiedName("require.ensure")) { visitRequireEnsureCall(n); } if (allowFullRewrite && n.isIf()) { FindModuleExportStatements commonjsFinder = new FindModuleExportStatements(); Node condition = n.getFirstChild(); NodeTraversal.traverseEs6(compiler, condition, commonjsFinder); if (commonjsFinder.isFound()) { visitCommonJSIfStatement(n); } else { FindDefineAmdStatements amdFinder = new FindDefineAmdStatements(); NodeTraversal.traverseEs6(compiler, condition, amdFinder); if (amdFinder.isFound()) { visitAMDIfStatement(n); } } } if (n.isScript()) { scriptNodeCount++; visitScript(t, n); } if (allowFullRewrite && n.isGetProp() && "module.exports".equals(n.getQualifiedName())) { Var v = t.getScope().getVar(MODULE); if (v == null) { moduleExportRefs.add(n); maybeAddReferenceCount(n); } } if (allowFullRewrite && n.isName() && EXPORTS.equals(n.getString())) { Var v = t.getScope().getVar(n.getString()); if (v == null || v.isGlobal()) { exportRefs.add(n); maybeAddReferenceCount(n); } } }
Source:
<code>public boolean getFastViewBarVisible() { return <START> fastViewBarVisible; <END> }</code><technical_language>I suggest this "false" remove field</technical_language>

Target:
public boolean getFastViewBarVisible() { return false; }
Source:
<code>public byte[] getByteArray() { byte[] bytes; if (buffer.hasArray()) { <START> return buffer.array(); <END> } else { int remaining = buffer.remaining(); bytes = new byte[remaining]; for (int i = 0; i < remaining; i++) { bytes[i] = buffer.get(); } } return bytes; }</code><technical_language>consistent flow, this "bytes = buffer.array()", a "bytes" variable is declared in line, returned in end</technical_language>

Target:
public byte[] getByteArray() { byte[] bytes; if (buffer.hasArray()) { bytes = buffer.array(); } else { int remaining = buffer.remaining(); bytes = new byte[remaining]; for (int i = 0; i < remaining; i++) { bytes[i] = buffer.get(); } } return bytes; }
Source:
<code>public boolean OpenSerial() { Log.d(LOG_TAG, "Opening connection"); <START> return mPhysicaloid.open(); <END> }</code><technical_language>Potential NPE if blocks called in right order. This is true in other functions in this class</technical_language>

Target:
public boolean OpenSerial() { Log.d(LOG_TAG, "Opening connection"); if (mPhysicaloid == null) { form.dispatchErrorOccurredEvent(Serial.this, "OpenSerial", ErrorMessages.ERROR_SERIAL_NOT_INITIALIZED); return false; } return mPhysicaloid.open(); }
Source:
<code>protected void doClean() throws SQLException { <START> for (String dropStatement : generateDropStatements(name, aliasType, "ALIAS")) { <END> System.out.println("Drop ALIAS : " + dropStatement); jdbcTemplate.execute(dropStatement); } for (Table table : allTables()) { System.out.println("cleanTable : " + table.getName()); table.drop(); } }</code><technical_language>is table type ALIAS</technical_language>

Target:
protected void doClean() throws SQLException { for (String dropStatement : generateDropStatements(name, viewValue, "VIEW")) { jdbcTemplate.execute(dropStatement); } for (String dropStatement : generateDropStatements(name, aliasValue, "ALIAS")) { jdbcTemplate.execute(dropStatement); } for (Table table : allTables()) { table.drop(); } for (String dropStatement : generateDropStatementsForSequences(name)) { jdbcTemplate.execute(dropStatement); } for (String dropStatement : generateDropStatementsForProcedures(name)) { jdbcTemplate.execute(dropStatement); } for (Function function : allFunctions()) { function.drop(); } for (Type type : allTypes()) { type.drop(); } }
Source:
<code>private boolean isYarnMode() { <START> return getProperty("master").equals("yarn-client") || getProperty("master").equals("yarn"); <END> }</code><technical_language>is this support master == "yarn-cluster"</technical_language>

Target:
private boolean isYarnMode() { return getProperty("master").startsWith("yarn"); }
Source:
<code>public void connectJob() { { for (Direction direction : Direction.values()) { if (isBlockWrappable(direction)) { BlockPos emptyBlockCoord = coordinate.pos; <START> direction.applyTo(new BlockPos.MutableBlockPos(emptyBlockCoord), 1); <END> for (LRDU lrdu : LRDU.values()) { Direction elementSide = direction.applyLRDU(lrdu); BlockPos otherBlockCoord = emptyBlockCoord; elementSide.applyTo(new BlockPos.MutableBlockPos(otherBlockCoord), 1); NodeBase otherNode = NodeManager.instance.getNodeFromCoordinate(new Coordinate(otherBlockCoord, coordinate.getDimension())); if (otherNode == null) continue; Direction otherDirection = elementSide.getInverse(); LRDU otherLRDU = otherDirection.getLRDUGoingTo(direction).inverse(); if (this instanceof SixNode || otherNode instanceof SixNode) { tryConnectTwoNode(this, direction, lrdu, otherNode, otherDirection, otherLRDU); } } } } } { for (Direction dir : Direction.values()) { NodeBase otherNode = getNeighbor(dir); if (otherNode != null && otherNode.isAdded) { for (LRDU lrdu : LRDU.values()) { tryConnectTwoNode(this, dir, lrdu, otherNode, dir.getInverse(), lrdu.inverseIfLR()); } } } } }</code><technical_language>I this works. creating a new MutableBlockPos, immediately throwing away; change emptyBlockCoord. If move new line up, though..</technical_language>

Target:
public void connectJob() { { for (Direction direction : Direction.values()) { if (isBlockWrappable(direction)) { BlockPos.MutableBlockPos emptyBlockCoord = new BlockPos.MutableBlockPos(coordinate.pos); direction.applyTo(emptyBlockCoord, 1); for (LRDU lrdu : LRDU.values()) { Direction elementSide = direction.applyLRDU(lrdu); BlockPos.MutableBlockPos otherBlockCoord = new BlockPos.MutableBlockPos(emptyBlockCoord); elementSide.applyTo(otherBlockCoord, 1); NodeBase otherNode = NodeManager.instance.getNodeFromCoordinate(new Coordinate(otherBlockCoord, coordinate.getDimension())); if (otherNode == null) continue; Direction otherDirection = elementSide.getInverse(); LRDU otherLRDU = otherDirection.getLRDUGoingTo(direction).inverse(); if (this instanceof SixNode || otherNode instanceof SixNode) { tryConnectTwoNode(this, direction, lrdu, otherNode, otherDirection, otherLRDU); } } } } } { for (Direction dir : Direction.values()) { NodeBase otherNode = getNeighbor(dir); if (otherNode != null && otherNode.isAdded) { for (LRDU lrdu : LRDU.values()) { tryConnectTwoNode(this, dir, lrdu, otherNode, dir.getInverse(), lrdu.inverseIfLR()); } } } } }
Source:
<code><START> private static AABB getAABB(Vector3i pos, int x, int y, int z) { <END> boolean flag = x < 0; boolean flag1 = y < 0; boolean flag2 = z < 0; int i = pos.getX() + (flag ? x : 0); int j = pos.getY() + (flag1 ? y : 0); int k = pos.getZ() + (flag2 ? z : 0); int l = pos.getX() + (flag ? 0 : x) + 1; int i1 = pos.getY() + (flag1 ? 0 : y) + 1; int j1 = pos.getZ() + (flag2 ? 0 : z) + 1; return new AABB((double)i, (double)j, (double)k, (double)l, (double)i1, (double)j1); }</code><technical_language>local variables in this method named</technical_language>

Target:
private static AABB getAABB(Vector3i pos, int x, int y, int z) { boolean isNegativeX = x < 0; boolean isNegativeY = y < 0; boolean isNegativeZ = z < 0; int xmin = pos.getX() + (isNegativeX ? x : 0); int ymin = pos.getY() + (isNegativeY ? y : 0); int zmin = pos.getZ() + (isNegativeZ ? z : 0); int xmax = pos.getX() + (isNegativeX ? 0 : x) + 1; int ymax = pos.getY() + (isNegativeY ? 0 : y) + 1; int zmax = pos.getZ() + (isNegativeZ ? 0 : z) + 1; return new AABB((double) xmin, (double) ymin, (double) zmin, (double) xmax, (double) ymax, (double) zmax); }
Source:
<code>public String convert(QueryBuilder anItem) { try { BytesReference bytes = anItem.toXContent(JsonXContent.contentBuilder(), new ToXContent.MapParams(null)) .bytes(); return bytes.utf8ToString(); } catch (IOException e) { log.error("Unable to transform querybuilder to a json string due to an exception", e); <START> return null; <END> } }</code><technical_language>I this I throw exception instead of silently accepting it, e.g. throw new RuntimeException("Unable transform ....", e);</technical_language>

Target:
public String convert(QueryBuilder anItem) { try { BytesReference bytes = anItem.toXContent(JsonXContent.contentBuilder(), new ToXContent.MapParams(null)) .bytes(); return bytes.utf8ToString(); } catch (IOException e) { log.error("Unable to transform querybuilder to a json string due to an exception", e); throw new RuntimeException("Unable to transform querybuilder to a json string due to an exception", e); } }
Source:
<code>private void createInitFailureDetailsFile(final String id, final Exception e) { final long start = System.nanoTime(); try { final File jobDir = new File(this.baseWorkingDirPath.getFile(), id); if (jobDir.exists()) { final File detailsFile = new File(jobDir, JobConstants.GENIE_INIT_FAILURE_MESSAGE_FILE_NAME); final boolean detailsFileExists = !detailsFile.createNewFile(); if (detailsFileExists) { log.warn("Init failure details file exists"); } <START> try (final Writer writer = new OutputStreamWriter(new FileOutputStream(detailsFile), "UTF-8")) { <END> writer.write("Job " + id + " failed initialization due to: " + e.getMessage()); writer.write(System.lineSeparator()); writer.write("Exception: " + e.getClass().getCanonicalName()); writer.write(System.lineSeparator()); writer.write("Trace:"); writer.write(System.lineSeparator()); e.printStackTrace(new PrintWriter(writer)); writer.write(System.lineSeparator()); } log.info("Created init failure details file {}", detailsFile); } else { log.error("Could not create init failure details file, job directory does not exist"); } } catch (Throwable t) { log.error("Failed to create init failure details file", t); } finally { this.createInitFailureDetailsFileTimer.record(System.nanoTime() - start, TimeUnit.NANOSECONDS); } }</code><technical_language>I a constant for UTF-8 lying in JobConstants..</technical_language>

Target:
private void createInitFailureDetailsFile(final String id, final Exception e) { final long start = System.nanoTime(); try { final File jobDir = new File(this.baseWorkingDirPath.getFile(), id); if (jobDir.exists()) { final File detailsFile = new File(jobDir, JobConstants.GENIE_INIT_FAILURE_MESSAGE_FILE_NAME); final boolean detailsFileExists = !detailsFile.createNewFile(); if (detailsFileExists) { log.warn("Init failure details file exists"); } try ( final PrintWriter p = new PrintWriter(new OutputStreamWriter( new FileOutputStream(detailsFile), StandardCharsets.UTF_8) ) ) { p.format(" *** Initialization failure for job: %s ***%n" + "%n" + "Exception: %s - %s%n" + "Trace:%n", id, e.getClass().getCanonicalName(), e.getMessage()); e.printStackTrace(p); } log.info("Created init failure details file {}", detailsFile); } else { log.error("Could not create init failure details file, job directory does not exist"); } } catch (Throwable t) { log.error("Failed to create init failure details file", t); } finally { this.createInitFailureDetailsFileTimer.record(System.nanoTime() - start, TimeUnit.NANOSECONDS); } }
Source:
<code>private void parseStramPropertyTokens(String[] keys, int index, String propertyName, String propertyValue, Conf conf) { if (index < keys.length) { String key = keys[index]; StramElement element = getElement(key, conf); if ((element == null) && conf.ignoreUnknownChildren()) { return; } if ((element == StramElement.APPLICATION) || (element == StramElement.OPERATOR) || (element == StramElement.STREAM) || (element == StramElement.PORT) || (element == StramElement.INPUT_PORT) || (element == StramElement.OUTPUT_PORT) || (element == StramElement.TEMPLATE)) { parseAppElement(index, keys, element, conf, propertyName, propertyValue); <START> } else if ((element == StramElement.GATEWAY)) { <END> parseGatewayElement(element, conf, keys, index, propertyName, propertyValue); } else if ((element == StramElement.ATTR) || ((element == null) && (conf.getDefaultChildElement() == StramElement.ATTR))) { parseAttributeElement(element, keys, index, conf, propertyValue, propertyName); } else if ((element == StramElement.PROP) || ((element == null) && (conf.getDefaultChildElement() == StramElement.PROP))) { parsePropertyElement(element, keys, index, conf, propertyValue, propertyName); } else if (element != null) { conf.parseElement(element, keys, index, propertyValue); } } }</code><technical_language>extra paranthesis</technical_language>

Target:
private void parseStramPropertyTokens(String[] keys, int index, String propertyName, String propertyValue, Conf conf) { if (index < keys.length) { String key = keys[index]; StramElement element = getElement(key, conf); if ((element == null) && conf.ignoreUnknownChildren()) { return; } if ((element == StramElement.APPLICATION) || (element == StramElement.OPERATOR) || (element == StramElement.STREAM) || (element == StramElement.PORT) || (element == StramElement.INPUT_PORT) || (element == StramElement.OUTPUT_PORT) || (element == StramElement.TEMPLATE)) { parseAppElement(index, keys, element, conf, propertyName, propertyValue); } else if (element == StramElement.GATEWAY) { parseGatewayElement(element, conf, keys, index, propertyName, propertyValue); } else if ((element == StramElement.ATTR) || ((element == null) && (conf.getDefaultChildElement() == StramElement.ATTR))) { parseAttributeElement(element, keys, index, conf, propertyValue, propertyName); } else if ((element == StramElement.PROP) || ((element == null) && (conf.getDefaultChildElement() == StramElement.PROP))) { parsePropertyElement(element, keys, index, conf, propertyValue, propertyName); } else if (element != null) { conf.parseElement(element, keys, index, propertyValue); } } }
Source:
<code>private static void ensureSameTenant(Iterable<Event> events) { checkNotNull(events); Set<TenantId> tenants = <START> StreamSupport.stream(events.spliterator(), false) <END> .map(Events::getTenantId) .collect(Collectors.toSet()); checkArgument(tenants.size() == 1, TENANT_MISMATCH_ERROR_MSG, tenants); }</code><technical_language>Please Streams.stream(Iterable) instead. Yes, Guava fixed this for us</technical_language>

Target:
private static void ensureSameTenant(Iterable<Event> events) { checkNotNull(events); Set<TenantId> tenants = Streams.stream(events) .map(Events::getTenantId) .collect(toSet()); checkArgument(tenants.size() == 1, TENANT_MISMATCH_ERROR_MSG, tenants); }
Source:
<code>public MCommand getOrCreateSpyCommand() { <START> application.getCommands().stream().filter(cmd -> SPY_COMMAND.equals(cmd.getElementId())).findFirst(); <END> MCommand command = modelService.createModelElement(MCommand.class); command.setElementId(SPY_COMMAND); command.setCommandName("Open a spy"); String contributorURI = "platform:/plugin/" + FrameworkUtil.getBundle(getClass()).getSymbolicName(); command.setContributorURI(contributorURI); command.setDescription("Open a spy in the E4 spy window"); MCommandParameter cp = modelService.createModelElement(MCommandParameter.class); cp.setElementId(SPY_COMMAND_PARAM); cp.setName("viewPart"); cp.setContributorURI(contributorURI); command.getParameters().add(cp); application.getCommands().add(command); for (MHandler hdl : application.getHandlers()) { if (SPY_HANDLER.equals(hdl.getElementId())) { return command; } } MHandler handler = modelService.createModelElement(MHandler.class); handler.setElementId(SPY_HANDLER); handler.setContributionURI("bundleclass://org.eclipse.e4.tools.spy/org.eclipse.e4.tools.spy.SpyHandler"); handler.setContributorURI("platform:/plugin/org.eclipse.e4.tools.spy"); application.getHandlers().add(handler); handler.setCommand(command); return command; }</code><technical_language>This equivalent: need return if command found</technical_language>

Target:
public MCommand getOrCreateSpyCommand() { Optional<MCommand> optionalCommand = application.getCommands().stream() .filter(cmd -> SPY_COMMAND.equals(cmd.getElementId())).findFirst(); if (optionalCommand.isPresent()) { return optionalCommand.get(); } MCommand command = modelService.createModelElement(MCommand.class); command.setElementId(SPY_COMMAND); command.setCommandName("Open a spy"); String contributorURI = "platform:/plugin/" + FrameworkUtil.getBundle(getClass()).getSymbolicName(); command.setContributorURI(contributorURI); command.setDescription("Open a spy in the E4 spy window"); MCommandParameter cp = modelService.createModelElement(MCommandParameter.class); cp.setElementId(SPY_COMMAND_PARAM); cp.setName("viewPart"); cp.setContributorURI(contributorURI); command.getParameters().add(cp); application.getCommands().add(command); for (MHandler hdl : application.getHandlers()) { if (SPY_HANDLER.equals(hdl.getElementId())) { return command; } } MHandler handler = modelService.createModelElement(MHandler.class); handler.setElementId(SPY_HANDLER); handler.setContributionURI("bundleclass://org.eclipse.e4.tools.spy/org.eclipse.e4.tools.spy.SpyHandler"); handler.setContributorURI("platform:/plugin/org.eclipse.e4.tools.spy"); application.getHandlers().add(handler); handler.setCommand(command); return command; }
Source:
<code>private static <T> T assertTimeoutPreemptively(Duration timeout, ThrowingSupplier<T> supplier, Object messageOrSupplier) { AtomicReference<Thread> threadReference = new AtomicReference<>(); ExecutorService executorService = Executors.newSingleThreadExecutor(runnable -> { Thread thread = Executors.defaultThreadFactory().newThread(runnable); threadReference.set(thread); return thread; <START> }); <END> try { Future<T> future = executorService.submit(() -> { try { return supplier.get(); } catch (Throwable throwable) { throw ExceptionUtils.throwAsUncheckedException(throwable); } }); long timeoutInMillis = timeout.toMillis(); try { return future.get(timeoutInMillis, TimeUnit.MILLISECONDS); } catch (TimeoutException ex) { ExecutionTimeoutException exception = new ExecutionTimeoutException("Execution timed out"); exception.setStackTrace(threadReference.get().getStackTrace()); throw new AssertionFailedError(buildPrefix(nullSafeGet(messageOrSupplier)) + "execution timed out after " + timeoutInMillis + " ms", exception); } catch (ExecutionException ex) { throw ExceptionUtils.throwAsUncheckedException(ex.getCause()); } catch (Throwable ex) { throw ExceptionUtils.throwAsUncheckedException(ex); } } finally { executorService.shutdownNow(); } }</code><technical_language>Do need special ThreadFactory? set threadReference in Runnable passed submit below</technical_language>

Target:
private static <T> T assertTimeoutPreemptively(Duration timeout, ThrowingSupplier<T> supplier, Object messageOrSupplier) { AtomicReference<Thread> threadReference = new AtomicReference<>(); ExecutorService executorService = Executors.newSingleThreadExecutor(); try { Future<T> future = executorService.submit(() -> { try { threadReference.set(Thread.currentThread()); return supplier.get(); } catch (Throwable throwable) { throw ExceptionUtils.throwAsUncheckedException(throwable); } }); long timeoutInMillis = timeout.toMillis(); try { return future.get(timeoutInMillis, TimeUnit.MILLISECONDS); } catch (TimeoutException ex) { String message = buildPrefix(nullSafeGet(messageOrSupplier)) + "execution timed out after " + timeoutInMillis + " ms"; Thread thread = threadReference.get(); if (thread != null) { ExecutionTimeoutException exception = new ExecutionTimeoutException( "Execution timed out in thread " + thread.getName()); exception.setStackTrace(thread.getStackTrace()); throw new AssertionFailedError(message, exception); } else { throw new AssertionFailedError(message); } } catch (ExecutionException ex) { throw ExceptionUtils.throwAsUncheckedException(ex.getCause()); } catch (Throwable ex) { throw ExceptionUtils.throwAsUncheckedException(ex); } } finally { executorService.shutdownNow(); } }
Source:
<code>public void announceSegment(DataSegment segment) throws IOException { Map.Entry<String, Integer> zNode = (zNodes.entrySet().isEmpty()) ? null : zNodes.entrySet().iterator().next(); <START> final String path = (zNode == null) ? makeServedSegmentPath(new DateTime().toString()) : zNode.getKey(); <END> Set<DataSegment> zkSegments = segmentReader.read(path); zkSegments.add(segment); if (zkSegments.size() >= config.getSegmentsPerNode()) { zNodes.remove(path); } else { zNodes.put(path, zkSegments.size()); } segmentLookup.put(segment.getIdentifier(), path); log.info("Announcing segment[%s] to path[%s]", segment.getIdentifier(), path); byte[] bytes = jsonMapper.writeValueAsBytes(zkSegments); if (bytes.length > config.getMaxNumBytes()) { throw new ISE("byte size %,d exceeds %,d", bytes.length, config.getMaxNumBytes()); } announcer.update(path, bytes); }</code><technical_language>I this easier reason written java final String path; if (zNodes.entrySet().isEmpty()) { path = makeServedSegmentPath(...); } else { path = zNodes.entrySet().iterator.next().getKey(); }</technical_language>

Target:
public void announceSegment(DataSegment segment) throws IOException { int newBytesLen = jsonMapper.writeValueAsBytes(segment).length; if (newBytesLen > config.getMaxNumBytes()) { throw new ISE("byte size %,d exceeds %,d", newBytesLen, config.getMaxNumBytes()); } if (availableZNodes.isEmpty()) { SegmentZNode availableZNode = new SegmentZNode(makeServedSegmentPath(new DateTime().toString())); availableZNode.addSegment(segment); log.info("Announcing segment[%s] at path[%s]", segment.getIdentifier(), availableZNode.getPath()); announcer.announce(availableZNode.getPath(), availableZNode.getBytes()); segmentLookup.put(segment, availableZNode); availableZNodes.add(availableZNode); } else { Iterator<SegmentZNode> iter = availableZNodes.iterator(); boolean done = false; while (iter.hasNext() && !done) { SegmentZNode availableZNode = iter.next(); if (availableZNode.getBytes().length + newBytesLen < config.getMaxNumBytes()) { availableZNode.addSegment(segment); log.info("Announcing segment[%s] at path[%s]", segment.getIdentifier(), availableZNode.getPath()); announcer.update(availableZNode.getPath(), availableZNode.getBytes()); segmentLookup.put(segment, availableZNode); if (availableZNode.getCount() >= config.getSegmentsPerNode()) { availableZNodes.remove(availableZNode); } done = true; } } } }
Source:
<code>public Object execute(ExecutionEvent event) throws ExecutionException { final IPageManager pageManager = getPageManager(event); if (pageManager == null) { return null; } List<EObject> selectedProperties = getCurrentSelectionAdaptedToType(event, EObject.class); if (selectedProperties == null) { return null; } final List<EObject> pagesToOpen = new LinkedList<>(); <START> List<EObject> pagesToSelect = new LinkedList<>(); <END> for (EObject selected : selectedProperties) { if (!canOpenByPolicy(selected)) { continue; } if (!pageManager.isOpen(selected) || isDuplicateDiagramAllowed) { pagesToOpen.add(selected); } else { pagesToSelect.add(selected); } } if (!pagesToOpen.isEmpty()) { for (EObject page : pagesToOpen) { pageManager.openPage(page); } } for (EObject page : pagesToSelect) { pageManager.selectPage(page); } return null; }</code><technical_language>Parameters</technical_language>

Target:
public Object execute(ExecutionEvent event) throws ExecutionException { final IPageManager pageManager = getPageManager(event); if (pageManager == null) { return null; } List<EObject> selectedProperties = getCurrentSelectionAdaptedToType(event, EObject.class); if (selectedProperties == null) { return null; } final List<EObject> pagesToOpen = new LinkedList<EObject>(); List<EObject> pagesToSelect = new LinkedList<EObject>(); for (EObject selected : selectedProperties) { if (!canOpenByPolicy(selected)) { continue; } if (!pageManager.isOpen(selected) || isDuplicateDiagramAllowed) { pagesToOpen.add(selected); } else { pagesToSelect.add(selected); } } if (!pagesToOpen.isEmpty()) { for (EObject page : pagesToOpen) { pageManager.openPage(page); } } for (EObject page : pagesToSelect) { pageManager.selectPage(page); } return null; }
Source:
<code>public void testReservedSkippableBeforeStreamIdentifier() throws Exception { ByteBuf in = Unpooled.wrappedBuffer(new byte[] { -0x7f, 0x06, 0x00, 0x00, 's', 'n', 'e', 't', 't', 'y' }); <START> assertFalse(channel.writeInbound(in)); <END> }</code><technical_language>I more sense omit this assert in expected exception cases</technical_language>

Target:
public void testReservedSkippableBeforeStreamIdentifier() throws Exception { ByteBuf in = Unpooled.wrappedBuffer(new byte[] { -0x7f, 0x06, 0x00, 0x00, 's', 'n', 'e', 't', 't', 'y' }); channel.writeInbound(in); }
Source:
<code>public void testStorageAndRetrieval() { final String dataToStore = "This a string intended for testing!"; ImmutableStorageProvider swarm = ImmutableStorageProviderFactory .getStorageProvider(ImmutableStorageProviderFactory.AvailableImmutableStorages.TEST, null); assertNotNull(swarm); try { swarm .store(dataToStore.getBytes(Charset.defaultCharset())) .thenCompose((hash)-> { LOGGER.debug("retrieved hash is: {}", hash); return swarm.retrieve(hash); }) .thenAccept((bytes)-> { try { String receivedMsg = IOUtils.toString(bytes, Charset.defaultCharset().name()); LOGGER.debug("retrieved msg is: {}", receivedMsg); assertEquals(dataToStore, receivedMsg); } catch (IOException e) { <START> e.printStackTrace(); <END> } }) .get(); } catch ( InterruptedException | ExecutionException ignored) { } }</code><technical_language>I throw error, do want test pass if this happens</technical_language>

Target:
public void testStorageAndRetrieval() throws ExecutionException, InterruptedException { final String dataToStore = "This a string intended for testing!"; ImmutableStorageProvider swarm = ImmutableStorageProviderFactory .getStorageProvider(ImmutableStorageProviderFactory.AvailableImmutableStorages.TEST, null); assertNotNull(swarm); swarm .store(new ByteArrayInputStream(dataToStore.getBytes(StandardCharsets.UTF_8))) .thenCompose((hash) -> { LOGGER.debug("retrieved hash is: {}", hash); return swarm.retrieve(hash); }) .thenAccept((bytes) -> { try { String receivedMsg = IOUtils.toString(bytes, StandardCharsets.UTF_8); LOGGER.debug("retrieved msg is: {}", receivedMsg); assertEquals(dataToStore, receivedMsg); } catch (IOException e) { throw new CompletionException(e); } }) .get(); }
Source:
<code>public void testAddMavenDescriptorSetToTrue() throws Exception { File basedir = getBasedir("projects/addMavenDescriptorSetToTrue"); File platform = new File("src/test/resources/eclipse"); List<MavenProject> projects = getSortedProjects(basedir, platform); MavenProject project = getProject(projects, "addMavenDescriptorSetToTrue"); PackageFeatureMojo mojo = (PackageFeatureMojo) lookupMojo("package-feature", project.getFile()); setVariableValueToObject(mojo, "project", project); setVariableValueToObject(mojo, "session", newMavenSession(project, projects)); setVariableValueToObject(mojo, "finalName", "feature"); mojo.execute(); ZipFile zip = new ZipFile(new File(basedir, "target/feature.jar")); ZipEntry entry = zip.getEntry("META-INF/maven"); assertNotNull("There must be a 'META-INF/maven/' entry in the feature.jar!", entry); <START> zip.close(); <END> }</code><technical_language>close() in finally block</technical_language>

Target:
public void testAddMavenDescriptorSetToTrue() throws Exception { File basedir = getBasedir("projects/addMavenDescriptor/featureForcedToTrue"); File platform = new File("src/test/resources/eclipse"); List<MavenProject> projects = getSortedProjects(basedir, platform); MavenProject project = getProject(projects, "featureForcedToTrue"); PackageFeatureMojo mojo = (PackageFeatureMojo) lookupMojo("package-feature", project.getFile()); setVariableValueToObject(mojo, "project", project); setVariableValueToObject(mojo, "session", newMavenSession(project, projects)); mojo.execute(); ZipFile zip = new ZipFile(new File(basedir, "target/featureForcedToTrue.jar")); try { ZipEntry entry = zip.getEntry("META-INF/maven"); assertNotNull("There must be a 'META-INF/maven/' entry in the feature.jar!", entry); } finally { zip.close(); } }
Source:
<code>private Set<AccountGroup.Id> queryForGroups(final DirContext ctx, final String username, LdapQuery.Result account) throws NamingException, AccountException { if (account == null) { account = findAccount(ctx, username); } <START> final Set<AccountGroup.Id> actual = new HashSet<AccountGroup.Id>(); <END> NamingEnumeration groups = account.getAll(accountMemberField).getAll(); while (groups.hasMore()) { final String dn = String.valueOf(groups.next()); if (!groupNames.containsKey(dn)) { groupNames.put(dn, groupsFor(ctx, dn)); } for (String cn : groupNames.get(dn)) { AccountGroup group = groupCache.lookup(cn); if (null != group && isLdapGroup(group)) { actual.add(group.getId()); } } } if (actual.isEmpty()) { return Collections.emptySet(); } else { return Collections.unmodifiableSet(actual); } }</code><technical_language>directory servers work way. common approaches for user-group management: * Groups a user belongs enumerated in user account in a multi-value attribute "memberOf". This is approach ActiveDirectory. * Users belong a group enumerated in group object a multi-value attribute, "member" "memberUid". This is approach OpenLDAP. Typically a server supports of approaches, both. I run servers support approach, aka OpenLDAP style. Gerrit admins run servers need approach, in ActiveDirectory environments. Therefore, Gerrit support approaches. need code looped groupMemberQueryList new code, allowing blocks populate actual set</technical_language>

Target:
private Set<AccountGroup.Id> queryForGroups(final DirContext ctx, final String username, LdapQuery.Result account) throws NamingException, AccountException { if (account == null) { account = findAccount(ctx, username); } final HashMap<String, String> params = new HashMap<String, String>(); params.put(USERNAME, username); if (groupNeedsAccount) { for (final String name : groupMemberQueryList.get(0).getParameters()) { params.put(name, account.get(name)); } } final Set<AccountGroup.Id> actual = new HashSet<AccountGroup.Id>(); for (LdapQuery groupMemberQuery : groupMemberQueryList) { for (LdapQuery.Result r : groupMemberQuery.query(ctx, params)) { final String name = r.get(groupName); final AccountGroup group = groupCache.lookup(name); if (group != null && isLdapGroup(group)) { actual.add(group.getId()); } } } NamingEnumeration groups = account.getAll(accountMemberField).getAll(); while (groups.hasMore()) { final String dn = (String) groups.next(); for (String cn : groupsFor(ctx, dn)) { AccountGroup group = groupCache.lookup(cn); if (null != group && isLdapGroup(group)) { actual.add(group.getId()); } } } if (actual.isEmpty()) { return Collections.emptySet(); } else { return Collections.unmodifiableSet(actual); } }
Source:
<code>protected void executeVmCommand() { addCustomValue("InterfaceType", (VmInterfaceType.forValue(getInterface().getType()).getDescription()).toString()); boolean succeeded = false; boolean macAddedToPool = false; <START> final MacPoolManagerStrategy macPool = getMacPoolForVm(); <END> try { if (isVnicProfileChanged(oldIface, getInterface())) { Network newNetwork = NetworkHelper.getNetworkByVnicProfileId(getInterface().getVnicProfileId()); Network oldNetwork = NetworkHelper.getNetworkByVnicProfileId(oldIface.getVnicProfileId()); if (ObjectUtils.notEqual(oldNetwork, newNetwork)) { new ExternalNetworkManager(oldIface).deallocateIfExternal(); } } if (macShouldBeChanged) { macAddedToPool = addMacToPool(getMacAddress(), macPool); } if (mustChangeAddress(oldIface.getType(), getInterface().getType())) { getVmDeviceDao().clearDeviceAddress(getInterface().getId()); } getInterface().setSpeed(VmInterfaceType.forValue(getInterface().getType()).getSpeed()); TransactionSupport.executeInNewTransaction(new TransactionMethod<Void>() { @Override public Void runInTransaction() { getCompensationContext().snapshotEntity(oldIface); getVmNicDao().update(getInterface()); getCompensationContext().stateChanged(); return null; } }); succeeded = updateHost(); } finally { setSucceeded(succeeded); if (macAddedToPool) { if (succeeded) { macPool.freeMac(oldIface.getMacAddress()); } else { macPool.freeMac(getMacAddress()); } } } }</code><technical_language>real define this in a variable</technical_language>

Target:
protected void executeVmCommand() { addCustomValue("InterfaceType", (VmInterfaceType.forValue(getInterface().getType()).getDescription()).toString()); boolean succeeded = false; boolean macAddedToPool = false; try { if (isVnicProfileChanged(oldIface, getInterface())) { Network newNetwork = NetworkHelper.getNetworkByVnicProfileId(getInterface().getVnicProfileId()); Network oldNetwork = NetworkHelper.getNetworkByVnicProfileId(oldIface.getVnicProfileId()); if (ObjectUtils.notEqual(oldNetwork, newNetwork)) { new ExternalNetworkManager(oldIface).deallocateIfExternal(); } } if (macShouldBeChanged) { macAddedToPool = addMacToPool(getMacAddress()); } if (mustChangeAddress(oldIface.getType(), getInterface().getType())) { getVmDeviceDao().clearDeviceAddress(getInterface().getId()); } getInterface().setSpeed(VmInterfaceType.forValue(getInterface().getType()).getSpeed()); TransactionSupport.executeInNewTransaction(new TransactionMethod<Void>() { @Override public Void runInTransaction() { getCompensationContext().snapshotEntity(oldIface); getVmNicDao().update(getInterface()); getCompensationContext().stateChanged(); return null; } }); succeeded = updateHost(); } finally { setSucceeded(succeeded); if (macAddedToPool) { if (succeeded) { getMacPool().freeMac(oldIface.getMacAddress()); } else { getMacPool().freeMac(getMacAddress()); } } } }
Source:
<code>public void initialize(Context context) { context.registerSyntaxNodeConsumer(Tree.Kind.FUNCDEF, ctx -> { <START> PyFunctionDefTree pyFunctionDefTree = ((PyFunctionDefTree) ctx.syntaxNode()); <END> if (!shouldCheckFunctionDeclaration(pyFunctionDefTree)) { return; } PyNameTree functionNameTree = pyFunctionDefTree.name(); String name = functionNameTree.name(); if (!pattern().matcher(name).matches()) { String message = String.format(MESSAGE, typeName(), name, this.format); ctx.addIssue(functionNameTree, message); } }); }</code><technical_language>unecessary parentheses</technical_language>

Target:
public void initialize(Context context) { context.registerSyntaxNodeConsumer(Tree.Kind.FUNCDEF, ctx -> { PyFunctionDefTree pyFunctionDefTree = (PyFunctionDefTree) ctx.syntaxNode(); if (!shouldCheckFunctionDeclaration(pyFunctionDefTree)) { return; } PyNameTree functionNameTree = pyFunctionDefTree.name(); String name = functionNameTree.name(); if (!pattern().matcher(name).matches()) { String message = String.format(MESSAGE, typeName(), name, this.format); ctx.addIssue(functionNameTree, message); } }); }
Source:
<code>final TychoRepositoryIndex createArtifactsIndex(File location) { return FileBasedTychoRepositoryIndex.createArtifactsIndex(location, new NoopFileLockService(), <START> new NoopMavenLogger()); <END> }</code><technical_language>Mockito instead? mock(MavenLogger.class)</technical_language>

Target:
final TychoRepositoryIndex createArtifactsIndex(File location) { return FileBasedTychoRepositoryIndex.createArtifactsIndex(location, new NoopFileLockService(), mock(MavenLogger.class)); }