auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public Expression implement( RexToLixTranslator translator, RexCall call, List<Expression> expressions) { if (backupMethodName != null) { Type type0 = expressions.get(0).getType(); Type type1 = expressions.get(1).getType(); final SqlBinaryOperator op = (SqlBinaryOperator) call.getOperator(); <START> if (type0 == Object.class || type1 == Object.class) { <END> final Primitive primitive0 = Primitive.of(type0); final Primitive primitive1 = Primitive.of(type1); Expression expression0 = expressions.get(0); Expression expression1 = expressions.get(1); if (primitive0 != null) { expression0 = Expressions.box(expression0, primitive0); } if (primitive1 != null) { expression1 = Expressions.box(expression1, primitive1); } return Expressions.call(SqlFunctions.class, backupMethodName, expression0, expression1); } else { final Primitive primitive = Primitive.ofBoxOr(type0); if (primitive == null || type1 == BigDecimal.class || COMPARISON_OPERATORS.contains(op) && !COMP_OP_TYPES.contains(primitive)) { return Expressions.call(SqlFunctions.class, backupMethodName, expressions); } } } final Type returnType = translator.typeFactory.getJavaClass(call.getType()); return Types.castIfNecessary(returnType, Expressions.makeBinary(expressionType, expressions.get(0), expressions.get(1))); }</code><technical_language>method takes a List<Expression> arg, assuming binary</technical_language>

Target:
public Expression implement( RexToLixTranslator translator, RexCall call, List<Expression> expressions) { if (backupMethodName != null) { RelDataType leftType = call.getOperands().get(0).getType(); RelDataType rightType = call.getOperands().get(1).getType(); if (leftType.getSqlTypeName().equals(SqlTypeName.ANY) || rightType.getSqlTypeName().equals(SqlTypeName.ANY)) { return callBackupMethodAnyType(translator, call, expressions); } Type type0 = expressions.get(0).getType(); Type type1 = expressions.get(1).getType(); final SqlBinaryOperator op = (SqlBinaryOperator) call.getOperator(); final Primitive primitive = Primitive.ofBoxOr(type0); if (primitive == null || type1 == BigDecimal.class || COMPARISON_OPERATORS.contains(op) && !COMP_OP_TYPES.contains(primitive)) { return Expressions.call(SqlFunctions.class, backupMethodName, expressions); } } final Type returnType = translator.typeFactory.getJavaClass(call.getType()); return Types.castIfNecessary(returnType, Expressions.makeBinary(expressionType, expressions.get(0), expressions.get(1))); }
Source:
<code>static int getSliceArrayRetainedSizeInBytes(Slice[] values) { long sizeInBytes = sizeOf(values); Map<Object, Boolean> uniqueRetained = new IdentityHashMap<>(values.length); boolean emptySliceExists = false; for (Slice value : values) { <START> if (value != null) { <END> if (value.getBase() != null) { if (uniqueRetained.put(value.getBase(), true) == null) { sizeInBytes += value.getRetainedSize(); } } else if (value.equals(EMPTY_SLICE)) { emptySliceExists = true; } } } return intSaturatedCast(sizeInBytes) + (emptySliceExists ? EMPTY_SLICE.getRetainedSize() : 0); }</code><technical_language>Write if (value == null) { continue; } instead</technical_language>

Target:
static int getSliceArrayRetainedSizeInBytes(Slice[] values) { long sizeInBytes = sizeOf(values); Map<Object, Boolean> uniqueRetained = new IdentityHashMap<>(values.length); for (Slice value : values) { if (value == null) { continue; } if (value.getBase() != null && uniqueRetained.put(value.getBase(), true) == null) { sizeInBytes += value.getRetainedSize(); } } return intSaturatedCast(sizeInBytes); }
Source:
<code>ServerSsdLocalityCostFunction(Configuration conf, MasterServices srv) { super( conf, srv, LocalityType.SERVER, true, LOCALITY_COST_KEY, DEFAULT_LOCALITY_COST <START> ); <END> }</code><technical_language>Please style of surrounding code. Params line, a line param</technical_language>

Target:
ServerSsdLocalityCostFunction(Configuration conf, MasterServices srv) { super(conf, srv, LocalityType.SERVER, IncludeStorageType.SSD, LOCALITY_COST_KEY, DEFAULT_LOCALITY_COST); }
Source:
<code>private FeatureMap.Entry getExpectedEntryWhenDiffSourceIsMergeTarget(final Comparison comparison, final FeatureMapChange diff) { final FeatureMap.Entry expectedEntry; final IEqualityHelper equalityHelper = comparison.getEqualityHelper(); final FeatureMap.Entry diffEntry = (FeatureMap.Entry)diff.getValue(); if (comparison.isThreeWay() && isFeatureMapContainment(diff)) { final Match matchValue = comparison.getMatch((EObject)diffEntry.getValue()); EStructuralFeature originKey = null; final List<Object> originList = (List<Object>)safeEGet(matchValue.getOrigin().eContainer(), diff .getAttribute()); for (Object object : originList) { if (object instanceof FeatureMap.Entry && equalityHelper.matchingValues(diffEntry.getValue(), ((FeatureMap.Entry)object) .getValue())) { originKey = ((FeatureMap.Entry)object).getEStructuralFeature(); break; } } expectedEntry = FeatureMapUtil.createEntry(originKey, diffEntry.getValue()); } else { <START> if (((EReference)diffEntry.getEStructuralFeature()).isContainment()) { <END> EStructuralFeature targetReference = getTargetReference(comparison, diff); expectedEntry = FeatureMapUtil.createEntry(targetReference, diffEntry.getValue()); } else { expectedEntry = diffEntry; } } return expectedEntry; }</code><technical_language>"merge" this in previous "else" (remove preceding '{' closing brace)</technical_language>

Target:
private FeatureMap.Entry getExpectedEntryWhenDiffSourceIsMergeTarget(final Comparison comparison, final FeatureMapChange diff) { final FeatureMap.Entry expectedEntry; final IEqualityHelper equalityHelper = comparison.getEqualityHelper(); final FeatureMap.Entry diffEntry = (FeatureMap.Entry)diff.getValue(); if (comparison.isThreeWay() && isFeatureMapContainment(diff)) { final Match matchValue = comparison.getMatch((EObject)diffEntry.getValue()); EStructuralFeature originKey = null; final List<Object> originList = (List<Object>)safeEGet(matchValue.getOrigin().eContainer(), diff .getAttribute()); for (Object object : originList) { if (object instanceof FeatureMap.Entry && equalityHelper.matchingValues(diffEntry.getValue(), ((FeatureMap.Entry)object) .getValue())) { originKey = ((FeatureMap.Entry)object).getEStructuralFeature(); break; } } expectedEntry = FeatureMapUtil.createEntry(originKey, diffEntry.getValue()); } else if (((EReference)diffEntry.getEStructuralFeature()).isContainment()) { EStructuralFeature targetReference = getTargetReference(comparison, diff); expectedEntry = FeatureMapUtil.createEntry(targetReference, diffEntry.getValue()); } else { expectedEntry = diffEntry; } return expectedEntry; }
Source:
<code>public void add(final Subscription s) { if (s == null) { <START> throw new IllegalArgumentException("Added Subscription cannot be null."); <END> } Subscription unsubscribe = null; synchronized (this) { if (unsubscribed) { unsubscribe = s; } else { if (subscriptions == null) { subscriptions = new HashSet<Subscription>(4); } subscriptions.add(s); } } if (unsubscribe != null) { unsubscribe.unsubscribe(); } }</code><technical_language>NullPointerException. Other null assertions in RxJava throws NPE</technical_language>

Target:
public void add(final Subscription s) { if (s.isUnsubscribed()) { return; } Subscription unsubscribe = null; synchronized (this) { if (unsubscribed) { unsubscribe = s; } else { if (subscriptions == null) { subscriptions = new HashSet<Subscription>(4); } subscriptions.add(s); } } if (unsubscribe != null) { unsubscribe.unsubscribe(); } }
Source:
<code>public ResourceIterableClosableIterable(ResourceIterable<Node> resourceIterable) { <START> this.iterator = resourceIterable.iterator(); <END> }</code><technical_language>this in iterator() method return resourceIterable.iterator();</technical_language>

Target:
public ResourceIterableClosableIterable(ResourceIterable<Node> resourceIterable) { this.resourceIterable = resourceIterable; this.requestedIterators = new ArrayList<ResourceIterator>(); }
Source:
<code>public static List<List<String>> getGroupReceiverList(BlobKey blobKey) throws IOException { Assumption.assertNotNull(blobKey); List<List<String>> listOfList = new LinkedList<>(); int offset = 0; int size = (int) getFileSize(blobKey); while (size > 0) { int bytesToRead = Math.min(size, MAX_READING_LENGTH); try (InputStream blobStream = new BlobstoreInputStream(blobKey, offset)) { byte[] array = new byte[bytesToRead]; <START> blobStream.read(array); <END> offset += MAX_READING_LENGTH; size -= MAX_READING_LENGTH; String readString = new String(array); List<String> newList = Arrays.asList(readString.split(",")); if (listOfList.isEmpty()) { listOfList.add(newList); } else { List<String> lastAddedList = listOfList.get(listOfList.size() - 1); String lastStringOfLastAddedList = lastAddedList.get(lastAddedList.size() - 1); String firstStringOfNewList = newList.get(0); if (lastStringOfLastAddedList.contains("@") && firstStringOfNewList.contains("@")) { listOfList.add(newList); } else { listOfList.get(listOfList.size() - 1) .set(lastAddedList.size() - 1, lastStringOfLastAddedList + firstStringOfNewList); listOfList.add(newList.subList(1, newList.size() - 1)); } } } } return listOfList; }</code><technical_language>For this one, try-with-resources block end here</technical_language>

Target:
public static List<List<String>> getGroupReceiverList(BlobKey blobKey) throws IOException { Assumption.assertNotNull(blobKey); List<List<String>> listOfList = new LinkedList<>(); int offset = 0; int size = (int) getFileSize(blobKey); while (size > 0) { byte[] array = new byte[Math.min(size, MAX_READING_LENGTH)];; try (InputStream blobStream = new BlobstoreInputStream(blobKey, offset)) { blobStream.read(array); } offset += MAX_READING_LENGTH; size -= MAX_READING_LENGTH; String readString = new String(array); List<String> newList = Arrays.asList(readString.split(",")); if (listOfList.isEmpty()) { listOfList.add(newList); } else { List<String> lastAddedList = listOfList.get(listOfList.size() - 1); String lastStringOfLastAddedList = lastAddedList.get(lastAddedList.size() - 1); String firstStringOfNewList = newList.get(0); if (lastStringOfLastAddedList.contains("@") && firstStringOfNewList.contains("@")) { listOfList.add(newList); } else { listOfList.get(listOfList.size() - 1) .set(lastAddedList.size() - 1, lastStringOfLastAddedList + firstStringOfNewList); listOfList.add(newList.subList(1, newList.size() - 1)); } } } return listOfList; }
Source:
<code>public void stop(boolean force) { OpenShiftServerBehaviour behavior = getBehavior(); IServer server = behavior.getServer(); IDeploymentConfig dc = OpenShiftServerUtils.getDeploymentConfig(server); boolean debugMode = OpenShiftLaunchController.DEBUG_MODE.equals(server.getMode()); behavior.setServerStopping(); try { if(dc == null) { OpenShiftDebugUtils.get().terminateRemoteDebugger(behavior.getServer()); } else if(debugMode) { DebuggingContext debugContext = OpenShiftDebugUtils.get().getDebuggingContext(dc); <START> OpenShiftLaunchController.stopDebugging(server, dc, debugContext, new NullProgressMonitor()); <END> } behavior.setServerStopped(); } catch(CoreException ce) { OpenShiftCoreActivator.getDefault().getLog().log( new Status(IStatus.ERROR, OpenShiftCoreActivator.PLUGIN_ID, "Error shutting down server", ce)); getBehavior().setServerStarted(); } }</code><technical_language>a lookup for OpenShiftLaunchController instance behavior.getController(IControllableServerBehavior.LAUNCH) call stopDebugging method</technical_language>

Target:
public void stop(boolean force) { OpenShiftServerBehaviour behavior = getBehavior(); behavior.setServerStopping(); try { if(OpenShiftDebugUtils.DEBUG_MODE.equals(getServer().getMode())) { OpenShiftDebugUtils.get().stopDebugging(getServer(), new NullProgressMonitor()); } behavior.setServerStopped(); } catch(CoreException ce) { OpenShiftCoreActivator.getDefault().getLog().log( new Status(IStatus.ERROR, OpenShiftCoreActivator.PLUGIN_ID, "Error shutting down server", ce)); getBehavior().setServerStarted(); } }
Source:
<code>public Object execute(ExecutionEvent event) throws ExecutionException { try { WizardUtils.openWizardDialog(new NewApplicationWizard(), HandlerUtil.getActiveShell(event)); <START> new RefreshResourceHandler().execute(event); <END> } catch (ConnectionNotFoundException e) { return new Status(Status.ERROR, OpenShiftUIActivator.PLUGIN_ID, "Unable to find the connection", e); } return Status.OK_STATUS; }</code><technical_language>is related autopublish issue</technical_language>

Target:
public Object execute(ExecutionEvent event) throws ExecutionException { try { WizardUtils.openWizardDialog(new NewApplicationWizard(), HandlerUtil.getActiveShell(event)); } catch (ConnectionNotFoundException e) { return new Status(Status.ERROR, OpenShiftUIActivator.PLUGIN_ID, "Unable to find the connection", e); } return Status.OK_STATUS; }
Source:
<code>public ProgramState checkPreStatement(CheckerContext context, Tree syntaxNode) { <START> if (context.getState().stackIsEmpty()) { <END> return context.getState(); } if (syntaxNode.is(Tree.Kind.METHOD_INVOCATION)) { MethodInvocationTree methodInvocation = (MethodInvocationTree) syntaxNode; Tree methodSelect = methodInvocation.methodSelect(); if (methodSelect.is(Tree.Kind.MEMBER_SELECT)) { SymbolicValue dereferencedSV = context.getState().peekValue(methodInvocation.arguments().size()); return checkConstraint(context, methodSelect, dereferencedSV); } } if(syntaxNode.is(Tree.Kind.ARRAY_ACCESS_EXPRESSION)) { Tree toCheck = ((ArrayAccessExpressionTree) syntaxNode).expression(); SymbolicValue currentVal = context.getState().peekValue(1); return checkConstraint(context, toCheck, currentVal); } if (syntaxNode.is(Tree.Kind.MEMBER_SELECT)) { return checkMemberSelect(context, (MemberSelectExpressionTree) syntaxNode, context.getState().peekValue()); } return context.getState(); }</code><technical_language>simply create a local method stackIsEmpty(ProgramState state) null-check? place need it, creating a method in ProgramState over-engineering me</technical_language>

Target:
public ProgramState checkPreStatement(CheckerContext context, Tree syntaxNode) { if (context.getState().peekValue() == null) { return context.getState(); } if (syntaxNode.is(Tree.Kind.METHOD_INVOCATION)) { MethodInvocationTree methodInvocation = (MethodInvocationTree) syntaxNode; Tree methodSelect = methodInvocation.methodSelect(); if (methodSelect.is(Tree.Kind.MEMBER_SELECT)) { SymbolicValue dereferencedSV = context.getState().peekValue(methodInvocation.arguments().size()); return checkConstraint(context, methodSelect, dereferencedSV); } } if(syntaxNode.is(Tree.Kind.ARRAY_ACCESS_EXPRESSION)) { Tree toCheck = ((ArrayAccessExpressionTree) syntaxNode).expression(); SymbolicValue currentVal = context.getState().peekValue(1); return checkConstraint(context, toCheck, currentVal); } if (syntaxNode.is(Tree.Kind.MEMBER_SELECT)) { return checkMemberSelect(context, (MemberSelectExpressionTree) syntaxNode, context.getState().peekValue()); } return context.getState(); }
Source:
<code>public String get(final String property) { Assert.hasText(property, "property should contain text."); final String secretName = getKeyVaultSecretName(property); <START> if (this.secretKeys == null || secretKeys.size() == 0) { <END> refreshPropertyNames(); } if (this.propertyNames.contains(secretName)) { final KeyVaultSecret secret = this.keyVaultClient.getSecret(secretName); return secret == null ? null : secret.getValue(); } else { return null; } }</code><technical_language>this consistently. is this another is not: this.secretKeys secretKeys</technical_language>

Target:
public String get(final String property) { Assert.hasText(property, "property should contain text."); final String secretName = getKeyVaultSecretName(property); if (this.secretKeys == null || secretKeys.size() == 0) { refreshPropertyNames(); } if (this.propertyNames.contains(secretName)) { final KeyVaultSecret secret = this.secretClient.getSecret(secretName); return secret == null ? null : secret.getValue(); } else { return null; } }
Source:
<code>public void onDestroyView() { <START> serverUrlPreference = null; <END> usernamePreference = null; passwordPreference = null; selectedGoogleAccountPreference = null; listPopupWindow = null; super.onDestroyView(); }</code><technical_language>need this. If a leak lets try work out causing if is a solve it</technical_language>

Target:
public void onDestroyView() { listPopupWindow = null; super.onDestroyView(); }
Source:
<code>public void dispose() { super.dispose(); <START> fCriticalPathModule.dispose(); <END> }</code><technical_language>this top</technical_language>

Target:
public void dispose() { fCriticalPathModule.dispose(); super.dispose(); }
Source:
<code>public void setErrorMessage(String errorMessage) { this.errorMessage = errorMessage; if (errorMessageText != null && !errorMessageText.isDisposed()) { errorMessageText.setText(errorMessage == null ? " \n " : errorMessage); <START> boolean hasError = errorMessage != null && !(StringConverter.removeWhiteSpaces(errorMessage)).isEmpty(); <END> errorMessageText.setEnabled(hasError); errorMessageText.setVisible(hasError); errorMessageText.getParent().update(); Control button = getButton(IDialogConstants.OK_ID); if (button != null) { button.setEnabled(errorMessage == null); } } }</code><technical_language>This is readable. "not" is method call</technical_language>

Target:
public void setErrorMessage(String errorMessage) { this.errorMessage = errorMessage; if (errorMessageText != null && !errorMessageText.isDisposed()) { errorMessageText.setText(errorMessage == null ? " \n " : errorMessage); boolean hasError = errorMessage != null && (StringConverter.removeWhiteSpaces(errorMessage)).length() > 0; errorMessageText.setEnabled(hasError); errorMessageText.setVisible(hasError); errorMessageText.getParent().update(); Control button = getButton(IDialogConstants.OK_ID); if (button != null) { button.setEnabled(errorMessage == null); } } }
Source:
<code>public void setId(long id) { <START> System.out.println(id); <END> this.id = id; }</code><technical_language>Remove this</technical_language>

Target:
public void setId(long id) { this.id = id; }
Source:
<code>public InterestChannelImpl(final SourcedEurekaRegistry<InstanceInfo> registry, final MessageConnection transport, final InterestChannelMetrics metrics) { super(STATES.Idle, transport, registry); this.metrics = metrics; this.metrics.incrementStateCounter(STATES.Idle); this.notificationMultiplexer = new InterestNotificationMultiplexer(registry); this.channelSubscriptionMonitor = new ChannelSubscriptionMonitor(metrics); subscribeToTransportInput(new Action1<Object>() { @Override public void call(Object message) { if (message instanceof SnapshotRegistration) { switch (state.get()) { case Idle: sendSnapshot(((SnapshotRegistration) message).getInterests()); state.set(STATES.Closed); <START> metrics.stateTransition(STATES.Idle, STATES.Open); <END> break; case Open: sendErrorOnTransport(SNAPSHOT_REQUEST_NOT_ALLOWED); break; case Closed: sendErrorOnTransport(CHANNEL_CLOSED_EXCEPTION); break; } } else if (message instanceof InterestRegistration) { Interest<InstanceInfo> interest = ((InterestRegistration) message).toComposite(); switch (state.get()) { case Idle: case Open: change(interest); break; case Closed: sendErrorOnTransport(CHANNEL_CLOSED_EXCEPTION); break; } } else if (message instanceof UnregisterInterestSet) { switch (state.get()) { case Idle: case Open: change(Interests.forNone()); break; case Closed: sendErrorOnTransport(CHANNEL_CLOSED_EXCEPTION); break; } } else { sendErrorOnTransport(new EurekaProtocolError("Unexpected message " + message)); } } }); }</code><technical_language>is state diagram for snapshot request? previous line sets state Closed metric transition moves Idle Open</technical_language>

Target:
public InterestChannelImpl(final SourcedEurekaRegistry<InstanceInfo> registry, final MessageConnection transport, final InterestChannelMetrics metrics) { super(STATES.Idle, transport, registry); this.metrics = metrics; this.metrics.incrementStateCounter(STATES.Idle); this.notificationMultiplexer = new InterestNotificationMultiplexer(registry); this.channelSubscriptionMonitor = new ChannelSubscriptionMonitor(metrics); subscribeToTransportInput(new Action1<Object>() { @Override public void call(Object message) { if (message instanceof SnapshotRegistration) { switch (state.get()) { case Idle: state.set(STATES.Open); metrics.stateTransition(STATES.Idle, STATES.Open); sendSnapshot(((SnapshotRegistration) message).getInterests()); state.set(STATES.Closed); metrics.stateTransition(STATES.Idle, STATES.Closed); break; case Open: sendErrorOnTransport(SNAPSHOT_REQUEST_NOT_ALLOWED); break; case Closed: sendErrorOnTransport(CHANNEL_CLOSED_EXCEPTION); break; } } else if (message instanceof InterestRegistration) { Interest<InstanceInfo> interest = ((InterestRegistration) message).toComposite(); switch (state.get()) { case Idle: case Open: change(interest); break; case Closed: sendErrorOnTransport(CHANNEL_CLOSED_EXCEPTION); break; } } else if (message instanceof UnregisterInterestSet) { switch (state.get()) { case Idle: case Open: change(Interests.forNone()); break; case Closed: sendErrorOnTransport(CHANNEL_CLOSED_EXCEPTION); break; } } else { sendErrorOnTransport(new EurekaProtocolError("Unexpected message " + message)); } } }); }
Source:
<code><START> public static Query setQuery(Parameters param) throws Exception { <END> Query query = new Query(param.getQuery()); if (!param.getPlace().isEmpty()) { PlaceApi googleFindPlace; googleFindPlace = new PlaceApi(param.getPlace()); GeoLocation geoLocation; geoLocation = new GeoLocation(googleFindPlace.getLocation().lat, googleFindPlace.getLocation().lng); query.setGeoCode(geoLocation, googleFindPlace.getRadius(), Query.KILOMETERS); } return query; }</code><technical_language>declared exception 'Exception' is thrown</technical_language>

Target:
public static Query setQuery(Parameters param) throws IOException { Query query = new Query(param.getQuery()); if (!param.getPlace().isEmpty()) { PlaceApi googleFindPlace; googleFindPlace = new PlaceApi(param.getPlace()); GeoLocation geoLocation; geoLocation = new GeoLocation(googleFindPlace.getLocation().lat, googleFindPlace.getLocation().lng); query.setGeoCode(geoLocation, googleFindPlace.getRadius(), Query.KILOMETERS); } return query; }
Source:
<code>public PointList getPolygonPoints() { if (getFigure() instanceof IRoundedRectangleFigure) { IRoundedRectangleFigure packageFigure = ((IRoundedRectangleFigure) ((IFigure) getFigure())); Rectangle packageHeader = packageFigure.getPackageHeader().getCopy(); packageFigure.translateToAbsolute(packageHeader); if (!packageHeader.isEmpty()) { PointList points = new PointList(5); Rectangle anchorableRectangle = getBox(); points.addPoint(anchorableRectangle.x, anchorableRectangle.y); points.addPoint(anchorableRectangle.x + packageHeader.width, anchorableRectangle.y); points.addPoint(anchorableRectangle.x + packageHeader.width, anchorableRectangle.y + packageHeader.height); points.addPoint(anchorableRectangle.x + anchorableRectangle.width, anchorableRectangle.y + packageHeader.height); points.addPoint(anchorableRectangle.x + anchorableRectangle.width, anchorableRectangle.y + anchorableRectangle.height); points.addPoint(anchorableRectangle.x, anchorableRectangle.y + anchorableRectangle.height); points.addPoint(anchorableRectangle.x, anchorableRectangle.y); return points; } else { return super.getPolygonPoints(); } } else { <START> return super.getPolygonPoints(); <END> } }</code><technical_language>return statement is required</technical_language>

Target:
public PointList getPolygonPoints() { PointList points = null; if (getFigure() instanceof IRoundedRectangleFigure) { IRoundedRectangleFigure packageFigure = ((IRoundedRectangleFigure) ((IFigure) getFigure())); Rectangle packageHeader = packageFigure.getPackageHeader().getCopy(); packageFigure.translateToAbsolute(packageHeader); if (!packageHeader.isEmpty()) { points = new PointList(5); Rectangle anchorableRectangle = getBox(); points.addPoint(anchorableRectangle.x, anchorableRectangle.y); points.addPoint(anchorableRectangle.x + packageHeader.width, anchorableRectangle.y); points.addPoint(anchorableRectangle.x + packageHeader.width, anchorableRectangle.y + packageHeader.height); points.addPoint(anchorableRectangle.x + anchorableRectangle.width, anchorableRectangle.y + packageHeader.height); points.addPoint(anchorableRectangle.x + anchorableRectangle.width, anchorableRectangle.y + anchorableRectangle.height); points.addPoint(anchorableRectangle.x, anchorableRectangle.y + anchorableRectangle.height); points.addPoint(anchorableRectangle.x, anchorableRectangle.y); } } return null != points ? points : super.getPolygonPoints(); }
Source:
<code>public boolean equals(final Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; if (!super.equals(o)) { return false; } final TagValueWildcardFilter otherTagValueFilter = (TagValueWildcardFilter) o; final boolean result = Objects.equal(has_postfix, otherTagValueFilter.has_postfix) && Objects.equal(has_prefix, otherTagValueFilter.has_prefix) && Objects.equal(matches_all, otherTagValueFilter.matchesAll()); if (!result) { return false; } if (components != null && otherTagValueFilter.components() == null || components == null && otherTagValueFilter.components() != null) { return false; } if (components != null) { <START> List<String> listComponents = Arrays.asList(components); <END> List<String> otherComponents = Arrays.asList(otherTagValueFilter.components()); if (!Comparators.ListComparison.equalLists(listComponents, otherComponents)) { return false; } } return true; }</code><technical_language>For this simpler filter string. breaks components need compare those. need pre post fixes part of parsing</technical_language>

Target:
public boolean equals(final Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; if (!super.equals(o)) { return false; } return true; }
Source:
<code><START> public Map<String, ArtifactReadable> getCoverageUnits(long branchUuid, String artifactUuid) { <END> IOseeBranch branch = TokenFactory.createBranch(branchUuid, ""); ArtifactReadable coveragePackage = getQuery().fromBranch(branchUuid).andGuid(artifactUuid).getResults().getOneOrNull(); List<ArtifactReadable> descendants = coveragePackage.getDescendants(); return getChildrenRecurse(descendants, branch); }</code><technical_language>branch is needed, if is, coveragePackage artifact readable</technical_language>

Target:
public Map<String, ArtifactReadable> getCoverageUnits(long branchUuid, String artifactUuid) { ArtifactReadable coveragePackage = getQuery().fromBranch(branchUuid).andGuid(artifactUuid).getResults().getOneOrNull(); List<ArtifactReadable> descendants = coveragePackage.getDescendants(); return getChildrenRecurse(descendants); }
Source:
<code><START> public ArrayInterface addString(String value) { <END> return addObject(value); }</code><technical_language>I return Array here</technical_language>

Target:
public Array addString(String value) { return addObject(value); }
Source:
<code>public TrackerBuilder sessionCheckInterval(long sessionCheckInterval) { <START> this.sessionCheckInterval = sessionCheckInterval; <END> return this; }</code><technical_language>Do need this long? save a bytes of memory removing it? :-)</technical_language>

Target:
public TrackerBuilder sessionCheckInterval(long sessionCheckInterval) { return this; }
Source:
<code>private void setMtuSelectorsChangeability(boolean isChangeable, String prohibitionReason) { if (!isChangeable) { getMtuSelector().setChangeProhibitionReason(prohibitionReason); getMtu().setChangeProhibitionReason(prohibitionReason); } getMtuSelector().setIsChangable(isChangeable); <START> getMtu().setIsChangable(isChangeable); <END> }</code><technical_language>this getMtu().setIsChangable(isChangeable && isCustomMtu())? This applies for prohibition reason above</technical_language>

Target:
private void setMtuSelectorsChangeability(boolean isChangeable, String prohibitionReason) { if (!isChangeable) { getMtuSelector().setChangeProhibitionReason(prohibitionReason); getMtu().setChangeProhibitionReason(prohibitionReason); } getMtuSelector().setIsChangable(isChangeable); getMtu().setIsChangable(isChangeable && isCustomMtu()); }
Source:
<code>public void setAttributeMappings( List<String> attributeMappingsList) { LOGGER.trace("Setting attribute mappings to: {}", attributeMappingsList); if (attributeMappingsList != null) { mappingEntries.clear(); attributeMappingsList .stream() .filter(StringUtils::isNotEmpty) .map( string -> { try { <START> return JsonFactory.create().readValue(string, Map.class); <END> } catch (JsonException e) { LOGGER.debug("Failed to parse attribute mapping json '{}'", string, e); } return null; }) .filter(Objects::nonNull) .filter(map -> map.get(ATTRIBUTE_NAME) instanceof String) .filter(map -> map.get(FEATURE_NAME) instanceof String) .filter(map -> map.get(TEMPLATE) instanceof String) .forEach( map -> addAttributeMapping( (String) map.get(ATTRIBUTE_NAME), (String) map.get(FEATURE_NAME), (String) map.get(TEMPLATE))); } }</code><technical_language>extract some of this separate methods for readability? filters condensed 1</technical_language>

Target:
public void setAttributeMappings( List<String> attributeMappingsList) { LOGGER.trace("Setting attribute mappings to: {}", attributeMappingsList); if (attributeMappingsList != null) { mappingEntries.clear(); attributeMappingsList .stream() .filter(StringUtils::isNotEmpty) .map(this::jsonToMap) .filter(this::validAttributeMapping) .forEach( map -> addAttributeMapping( (String) map.get(ATTRIBUTE_NAME), (String) map.get(FEATURE_NAME), (String) map.get(TEMPLATE))); } }
Source:
<code>public void createPartControl(final Composite parent) { fParentComposite = parent; if (this instanceof ITmfTimeAligned) { contributeAlignViewsActionToToolbar(); fParentComposite.addPaintListener(new PaintListener() { <START> @Override <END> public void paintControl(PaintEvent e) { fParentComposite.removePaintListener(this); fTimeAlignmentSynchronizer.handleViewCreated(TmfView.this); fControlListener = new ControlAdapter() { @Override public void controlResized(ControlEvent event) { fTimeAlignmentSynchronizer.handleViewResized(TmfView.this); } }; fParentComposite.addControlListener(fControlListener); } }); getSite().getPage().addPartListener(new IPartListener() { @Override public void partOpened(IWorkbenchPart part) { } @Override public void partDeactivated(IWorkbenchPart part) { } @Override public void partClosed(IWorkbenchPart part) { if (part == TmfView.this && fControlListener != null && !fParentComposite.isDisposed()) { fParentComposite.removeControlListener(fControlListener); fControlListener = null; } } @Override public void partBroughtToTop(IWorkbenchPart part) { } @Override public void partActivated(IWorkbenchPart part) { } }); } }</code><technical_language>paint listener is called for GTK2 Windows opening a view trace is opened a Trace Compass restart while a trace opened. GTK3 works Try IPartListener2 in method inti() need override. I a prototype promising</technical_language>

Target:
public void createPartControl(final Composite parent) { fParentComposite = parent; if (this instanceof ITmfTimeAligned) { contributeAlignViewsActionToToolbar(); fParentComposite.addPaintListener(new PaintListener() { @Override public void paintControl(PaintEvent e) { fParentComposite.removePaintListener(this); TIME_ALIGNMENT_SYNCHRONIZER.handleViewCreated(TmfView.this); fControlListener = new ControlAdapter() { @Override public void controlResized(ControlEvent event) { TIME_ALIGNMENT_SYNCHRONIZER.handleViewResized(TmfView.this); } }; fParentComposite.addControlListener(fControlListener); } }); getSite().getPage().addPartListener(new IPartListener() { @Override public void partOpened(IWorkbenchPart part) { } @Override public void partDeactivated(IWorkbenchPart part) { } @Override public void partClosed(IWorkbenchPart part) { if (part == TmfView.this && fControlListener != null && !fParentComposite.isDisposed()) { fParentComposite.removeControlListener(fControlListener); fControlListener = null; getSite().getPage().removePartListener(this); } } @Override public void partBroughtToTop(IWorkbenchPart part) { } @Override public void partActivated(IWorkbenchPart part) { } }); } }
Source:
<code>public void shouldLogWhenTopicLeaderNotAvailableAndThrowException() { final String topicLeaderNotAvailable = "LeaderNotAvailableTopic"; mockAdminClient.addTopic( false, topicLeaderNotAvailable, Collections.singletonList(new TopicPartitionInfo(0, broker1, cluster, Collections.emptyList())), null); final InternalTopicConfig internalTopicConfig = new RepartitionTopicConfig(topicLeaderNotAvailable, Collections.emptyMap()); internalTopicConfig.setNumberOfPartitions(1); final Map<String, InternalTopicConfig> topicConfigMap = new HashMap<>(); topicConfigMap.put(topicLeaderNotAvailable, internalTopicConfig); LogCaptureAppender.setClassLoggerToDebug(InternalTopicManager.class); try (final LogCaptureAppender appender = LogCaptureAppender.createAndRegister(InternalTopicManager.class)) { final StreamsException exception = assertThrows( StreamsException.class, () -> internalTopicManager.makeReady(topicConfigMap)); <START> final String expectedMessage = "Could not create topics after 1 retries. This can happen if the Kafka cluster is temporary not available"; <END> assertTrue(exception.getMessage().contains(expectedMessage)); final String logLeaderNotAvailable = "The leader of Topic " + topicLeaderNotAvailable + " is not available"; assertThat(appender.getMessages(), hasItem(containsString(logLeaderNotAvailable))); final String logCreateTopic = "Going to create topic " + topicLeaderNotAvailable; final String logTopicExistsException = "TopicExistsException"; assertThat(appender.getMessages(), not(hasItem(containsString(logCreateTopic)))); assertThat(appender.getMessages(), not(hasItem(containsString(logTopicExistsException)))); } }</code><technical_language>Testing log message is error-prone hard maintain, I making thrown exception type is expected sufficient</technical_language>

Target:
public void shouldLogWhenTopicLeaderNotAvailableAndThrowException() { mockAdminClient.addTopic( false, MockAdminClient.LEADER_NOT_AVAILABLE_TOPIC, Collections.singletonList(new TopicPartitionInfo(0, broker1, cluster, Collections.emptyList())), null); final InternalTopicConfig internalTopicConfig = new RepartitionTopicConfig(MockAdminClient.LEADER_NOT_AVAILABLE_TOPIC, Collections.emptyMap()); internalTopicConfig.setNumberOfPartitions(1); final Map<String, InternalTopicConfig> topicConfigMap = new HashMap<>(); topicConfigMap.put(MockAdminClient.LEADER_NOT_AVAILABLE_TOPIC, internalTopicConfig); LogCaptureAppender.setClassLoggerToDebug(InternalTopicManager.class); try (final LogCaptureAppender appender = LogCaptureAppender.createAndRegister(InternalTopicManager.class)) { final StreamsException exception = assertThrows( StreamsException.class, () -> internalTopicManager.makeReady(topicConfigMap)); } }
Source:
<code>public static <START> String getDifferenceInYears(@NonNull <END> String yearStr) { Context context = WikipediaApp.getInstance().getApplicationContext(); int year = Integer.parseInt(yearStr); int currentYear = Calendar.getInstance().get(Calendar.YEAR); switch (currentYear - year) { case 0: return context.getString(R.string.this_year); case 1: return context.getString(R.string.last_year); default: return String.format(context.getString(R.string.diff_in_years_text), String.valueOf(currentYear - year)); } }</code><technical_language>a @NonNull, return a @NonNull. ;)</technical_language>

Target:
public static String getDifferenceInYears(@NonNull String yearStr) { Context context = WikipediaApp.getInstance().getApplicationContext(); int diffInYears = Calendar.getInstance().get(Calendar.YEAR) - Integer.parseInt(yearStr); if (diffInYears == 0) { return context.getString(R.string.this_year); } else { return getQuantityString(context, R.plurals.diff_years, diffInYears, diffInYears); } }
Source:
<code><START> private static double alpha(final double meanBias, final double biasVariance) { <END> return meanBias * meanBias / biasVariance; }</code><technical_language>worth making of methods public</technical_language>

Target:
public static double alpha(final double meanBias, final double biasVariance) { return meanBias * meanBias / biasVariance; }
Source:
<code>private TaskProgressCallback getProgressCallback() { <START> return this.progressCallback == null ? null : this.progressCallback.get(); <END> }</code><technical_language>I guess remove unnecessary this. accessor getters well</technical_language>

Target:
private TaskProgressCallback getProgressCallback() { return progressCallback == null ? null : progressCallback.get(); }
Source:
<code>private void resolveAnnotations(BlockScope scope, Annotation[] annotations, Binding currentBinding) { int length = annotations == null ? 0 : annotations.length; if (length == 0) return; boolean old = scope.insideTypeAnnotation; scope.insideTypeAnnotation = true; currentBinding.getAnnotationTagBits(); scope.insideTypeAnnotation = old; ElementImpl element = (ElementImpl) _factory.newElement(currentBinding); AnnotationBinding annotationBindings = element.getPackedAnnotationBindings(); for (AnnotationBinding binding : annotationBindings) { <START> if (binding == null) continue; <END> ReferenceBinding annotationType = binding.getAnnotationType(); if (Annotation.isAnnotationTargetAllowed(scope, annotationType, currentBinding)) { TypeElement anno = (TypeElement)_factory.newElement(annotationType); _annoToElement.put(anno, element); } } }</code><technical_language>Instead of this check Factory.getPackedAnnotationBindings method fixed put nulls in returned array. This Factory.getPackedAnnotationBindings consistent Factory.getUnpackedAnnotationBindings</technical_language>

Target:
private void resolveAnnotations(BlockScope scope, Annotation[] annotations, Binding currentBinding) { int length = annotations == null ? 0 : annotations.length; if (length == 0) return; boolean old = scope.insideTypeAnnotation; scope.insideTypeAnnotation = true; currentBinding.getAnnotationTagBits(); scope.insideTypeAnnotation = old; ElementImpl element = (ElementImpl) _factory.newElement(currentBinding); AnnotationBinding annotationBindings = element.getPackedAnnotationBindings(); for (AnnotationBinding binding : annotationBindings) { ReferenceBinding annotationType = binding.getAnnotationType(); if (binding != null && Annotation.isAnnotationTargetAllowed(scope, annotationType, currentBinding) ) { TypeElement anno = (TypeElement)_factory.newElement(annotationType); _annoToElement.put(anno, element); } } }
Source:
<code><START> public void testDeleteAuthorRelationshipCopyToBothItems() throws Exception { <END> initPublicationAuthor(); getClient(adminAuthToken).perform( delete("/api/core/relationships/" + relationship.getID() + "?copyVirtualMetadata=all")) .andExpect(status().isNoContent()); leftItem = itemService.find(context, leftItem.getID()); List<MetadataValue> authorList = itemService.getMetadata(leftItem, "dc", "contributor", "author", Item.ANY); assertThat(authorList.size(), equalTo(1)); assertThat(authorList.get(0).getValue(), equalTo("familyName, firstName")); assertThat(authorList.get(0).getMetadataField().getMetadataSchema().getName(), equalTo("dc")); assertThat(authorList.get(0).getMetadataField().getElement(), equalTo("contributor")); assertThat(authorList.get(0).getMetadataField().getQualifier(), equalTo("author")); assertNull(authorList.get(0).getAuthority()); List<MetadataValue> relationshipMetadataList = itemService .getMetadata(leftItem, "relation", "isAuthorOfPublication", null, Item.ANY); assertThat(relationshipMetadataList.size(), equalTo(0)); }</code><technical_language>This test method test Left item *not* items</technical_language>

Target:
public void testDeleteAuthorRelationshipCopyToBothItems() throws Exception { initPublicationAuthor(); getClient(adminAuthToken).perform( delete("/api/core/relationships/" + relationship.getID() + "?copyVirtualMetadata=all")) .andExpect(status().isNoContent()); leftItem = itemService.find(context, leftItem.getID()); List<MetadataValue> authorList = itemService.getMetadata(leftItem, "dc", "contributor", "author", Item.ANY); assertThat(authorList.size(), equalTo(1)); assertThat(authorList.get(0).getValue(), equalTo("familyName, firstName")); assertThat(authorList.get(0).getMetadataField().getMetadataSchema().getName(), equalTo("dc")); assertThat(authorList.get(0).getMetadataField().getElement(), equalTo("contributor")); assertThat(authorList.get(0).getMetadataField().getQualifier(), equalTo("author")); assertNull(authorList.get(0).getAuthority()); List<MetadataValue> relationshipMetadataList = itemService .getMetadata(leftItem, "relation", "isAuthorOfPublication", null, Item.ANY); assertThat(relationshipMetadataList.size(), equalTo(0)); relationshipMetadataList = itemService .getMetadata(rightItem, "relation", "isPublicationOfAuthor", null, Item.ANY); assertThat(relationshipMetadataList.size(), equalTo(0)); }
Source:
<code>int blockPlayerWin() { int equalCount = 0; int emptyI = 0, emptyJ = 0; int winCombinationsNumber = fieldSize * 2 + 2; for (int k = 0; k < winCombinationsNumber; k++) { equalCount = 0; for (int i = 0; i < fieldSize; i++) for (int j = 0; j < fieldSize; j++) { <START> if (fieldArray[i][j] == playerMark && (getWinCombination(k, i, j) == 1)) equalCount++; END> if ((fieldArray[i][j] == 0) && (getWinCombination(k, i, j) == 1)) { emptyI = i; emptyJ = j; } if ((fieldArray[i][j] == aIMark) && (getWinCombination(k, i, j) == 1)) { j = fieldSize; i = fieldSize; equalCount = 0; } } if (equalCount == (fieldSize - 1)) { return (emptyI * fieldSize + emptyJ); } } return NOTHING_TO_PREVENT; }</code><technical_language>Braces</technical_language>

Target:
int blockPlayerWin() { int equalCount = 0; int emptyI = 0, emptyJ = 0; int winCombinationsNumber = fieldSize * 2 + 2; for (int k = 0; k < winCombinationsNumber; k++) { equalCount = 0; for (int i = 0; i < fieldSize; i++) for (int j = 0; j < fieldSize; j++) { if (fieldArray[i][j] == playerMark && (getWinCombination(k, i, j) == 1)) { equalCount++; } if ((fieldArray[i][j] == 0) && (getWinCombination(k, i, j) == 1)) { emptyI = i; emptyJ = j; } if ((fieldArray[i][j] == aIMark) && (getWinCombination(k, i, j) == 1)) { j = fieldSize; i = fieldSize; equalCount = 0; } } if (equalCount == (fieldSize - 1)) { return (emptyI * fieldSize + emptyJ); } } return NOTHING_TO_PREVENT; }
Source:
<code>public String getColumnText(@Nullable Object element, int columnIndex) { if (columnIndex == 0 && element instanceof TmfTreeViewerEntry) { return String.valueOf(((TmfTreeViewerEntry) element).getName()); } else if (element instanceof TmfGenericTreeEntry) { SegmentStoreStatisticsModel model = ((TmfGenericTreeEntry<@NonNull SegmentStoreStatisticsModel>) element).getModel(); if (model.getNbElements() == 0) { return ""; } if (columnIndex == 1) { return toFormattedString(model.getMin()); } else if (columnIndex == 2) { return String.valueOf(toFormattedString(model.getMax())); } else if (columnIndex == 3) { return String.valueOf(toFormattedString(model.getMean())); } else if (columnIndex == 4) { return String.valueOf(toFormattedString(model.getStdDev())); } else if (columnIndex == 5) { return String.valueOf(model.getNbElements()); } else if (columnIndex == 6) { return String.valueOf(toFormattedString(model.getTotal())); } <START> } <END> return ""; }</code><technical_language>need previous code in else-if-statements support legacy</technical_language>

Target:
public String getColumnText(@Nullable Object element, int columnIndex) { if (columnIndex == 0 && element instanceof TmfTreeViewerEntry) { return String.valueOf(((TmfTreeViewerEntry) element).getName()); } else if (element instanceof TmfGenericTreeEntry) { SegmentStoreStatisticsModel model = ((TmfGenericTreeEntry<@NonNull SegmentStoreStatisticsModel>) element).getModel(); if (model.getNbElements() == 0) { return ""; } if (columnIndex == 1) { return toFormattedString(model.getMin()); } else if (columnIndex == 2) { return String.valueOf(toFormattedString(model.getMax())); } else if (columnIndex == 3) { return String.valueOf(toFormattedString(model.getMean())); } else if (columnIndex == 4) { return String.valueOf(toFormattedString(model.getStdDev())); } else if (columnIndex == 5) { return String.valueOf(model.getNbElements()); } else if (columnIndex == 6) { return String.valueOf(toFormattedString(model.getTotal())); } } if (element instanceof SegmentStoreStatisticsEntry) { IStatistics<ISegment> statistics = ((SegmentStoreStatisticsEntry) element).getEntry(); if (statistics.getNbElements() > 0) { if (columnIndex == 1) { return toFormattedString(statistics.getMin()); } else if (columnIndex == 2) { return String.valueOf(toFormattedString(statistics.getMax())); } else if (columnIndex == 3) { return String.valueOf(toFormattedString(statistics.getMean())); } else if (columnIndex == 4) { return String.valueOf(toFormattedString(statistics.getStdDev())); } else if (columnIndex == 5) { return String.valueOf(statistics.getNbElements()); } else if (columnIndex == 6) { return String.valueOf(toFormattedString(statistics.getTotal())); } } } return ""; }
Source:
<code>public static int clearItemInOffHand(final Player p, final ItemStack item) { <START> if (hasMainHandSupport == null || hasMainHandSupport) { <END> try { int removedAmount = 0; if (p.getInventory().getItemInOffHand().getType().equals(item.getType())) { removedAmount = p.getInventory().getItemInOffHand().getAmount(); p.getInventory().setItemInOffHand(null); } hasMainHandSupport = true; return removedAmount; } catch (final Throwable e) { hasMainHandSupport = false; return 0; } } return 0; }</code><technical_language>This if return true, making need for</technical_language>

Target:
public static int clearItemInOffHand(final Player p, final ItemStack item) { if (hasMainHandSupport == null || hasMainHandSupport) { try { int removedAmount = 0; if (p.getInventory().getItemInOffHand().getType().equals(item.getType())) { removedAmount = p.getInventory().getItemInOffHand().getAmount(); p.getInventory().setItemInOffHand(null); } hasMainHandSupport = true; return removedAmount; } catch (final Throwable e) { hasMainHandSupport = false; } } return 0; }