auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public void serviceChanged(ServiceEvent serviceEvent) { if (serviceEvent.getType() == ServiceEvent.REGISTERED) { BundleContext context = getContext(); <START> if (context == null) { <END> return; } try { ServiceReference<ConfigurationAdmin> configAdminRef = context.getServiceReference(ConfigurationAdmin.class); ConfigurationAdmin configAdmin = context.getService(configAdminRef); Configuration config = configAdmin.getConfiguration(ApplicationServiceImpl.class.getName()); Dictionary<String, Object> properties = config.getProperties(); LOGGER.debug("Checking the configuration file on the first run."); ApplicationConfigInstaller configInstaller = new ApplicationConfigInstaller( configFileName, this, featuresService, POST_CONFIG_START, POST_CONFIG_STOP); configInstaller.start(); config.update(properties); } catch (Exception e) { LOGGER.warn("Could not check for installer application configuration file.", e); } finally { context.removeServiceListener(this); } } }</code><technical_language>I realizing a lot of checks for bundle context null. I cleaner remove checks instead throw IllegalStateException in getContext() method instead of returning null. files in this pr benefit this change</technical_language>

Target:
public void serviceChanged(ServiceEvent serviceEvent) { if (serviceEvent.getType() == ServiceEvent.REGISTERED) { BundleContext context = getContext(); try { ServiceReference<ConfigurationAdmin> configAdminRef = context.getServiceReference(ConfigurationAdmin.class); ConfigurationAdmin configAdmin = context.getService(configAdminRef); Configuration config = configAdmin.getConfiguration(ApplicationServiceImpl.class.getName()); Dictionary<String, Object> properties = config.getProperties(); LOGGER.debug("Checking the configuration file on the first run."); ApplicationConfigInstaller configInstaller = new ApplicationConfigInstaller( configFileName, this, featuresService, POST_CONFIG_START, POST_CONFIG_STOP); configInstaller.start(); config.update(properties); } catch (Exception e) { LOGGER.warn("Could not check for installer application configuration file.", e); } finally { context.removeServiceListener(this); } } }
Source:
<code><START> private static boolean isGetter(Method method) { <END> String name = method.getName(); if (!name.startsWith("get")) return false; if (name.length() == 3) return false; if (name.equals("getClass")) return false; if (void.class.equals(method.getReturnType())) return false; if (method.getParameterTypes().length != 0) return false; return true; }</code><technical_language>cached</technical_language>

Target:
private static boolean isGetter(Method method) { String name = method.getName(); if (!name.startsWith("get")) { return false; } if (name.length() == 3) { return false; } if (name.equals("getClass")) { return false; } if (void.class.equals(method.getReturnType())) { return false; } if (method.getParameterTypes().length != 0) { return false; } return true; }
Source:
<code>public GraphQLObjectType(String name, String description, List<GraphQLFieldDefinition> fieldDefinitions, List<GraphQLOutputType> interfaces, ObjectTypeDefinition definition) { assertValidName(name); assertNotNull(fieldDefinitions, "fieldDefinitions can't be null"); assertNotNull(interfaces, "interfaces can't be null"); <START> assertNotNull(interfaces, "unresolvedInterfaces can't be null"); <END> this.name = name; this.description = description; this.interfaces = interfaces; this.definition = definition; buildDefinitionMap(fieldDefinitions); }</code><technical_language>assertNotNull(interfaces, "unresolvedInterfaces null"); This is a leftover implementation, deleted</technical_language>

Target:
public GraphQLObjectType(String name, String description, List<GraphQLFieldDefinition> fieldDefinitions, List<GraphQLOutputType> interfaces, ObjectTypeDefinition definition) { assertValidName(name); assertNotNull(fieldDefinitions, "fieldDefinitions can't be null"); assertNotNull(interfaces, "interfaces can't be null"); this.name = name; this.description = description; this.interfaces = interfaces; this.definition = definition; buildDefinitionMap(fieldDefinitions); }
Source:
<code>public void trackShowTranscript(String videoId, Double currentTime, String courseId, String unitUrl) { final FirebaseEvent event = new FirebaseEvent(Events.SHOW_TRANSCRIPT, videoId, Values.TRANSCRIPT_SHOWN, currentTime); event.setCourseContext(courseId, unitUrl, Values.VIDEOPLAYER); tracker.logEvent(event.getName(), event.getBundle()); <START> ; <END> }</code><technical_language>remove ;</technical_language>

Target:
public void trackShowTranscript(String videoId, Double currentTime, String courseId, String unitUrl) { final FirebaseEvent event = new FirebaseEvent(Events.SHOW_TRANSCRIPT, videoId, Values.TRANSCRIPT_SHOWN, currentTime); event.setCourseContext(courseId, unitUrl, Values.VIDEOPLAYER); tracker.logEvent(event.getName(), event.getBundle()); }
Source:
<code>public VdcActionParametersBase getParameters(Host incoming, VDS entity) { VdsStatic updated = getMapper(modelType, VdsStatic.class).map(incoming, entity.getStaticData()); <START> UpdateVdsActionParameters updateParams = new UpdateVdsActionParameters(updated, "root", "", false); <END> if (incoming.isSetOverrideIptables()) { updateParams.setOverrideFirewall(incoming.isOverrideIptables()); } return updateParams; }</code><technical_language>hardcode</technical_language>

Target:
public VdcActionParametersBase getParameters(Host incoming, VDS entity) { VdsStatic updated = getMapper(modelType, VdsStatic.class).map(incoming, entity.getStaticData()); UpdateVdsActionParameters updateParams = new UpdateVdsActionParameters(updated, "", false); if (incoming.isSetOverrideIptables()) { updateParams.setOverrideFirewall(incoming.isOverrideIptables()); } return updateParams; }
Source:
<code>public static String getConfiguredHashAlgorithm(Configuration conf) { <START> return conf.get(CRYPTO_KEY_HASH_ALGORITHM_CONF_KEY, <END> CRYPTO_KEY_HASH_ALGORITHM_CONF_DEFAULT).trim(); }</code><technical_language>config.getTrimmedStrings() instead</technical_language>

Target:
public static String getConfiguredHashAlgorithm(Configuration conf) { return conf.getTrimmed(CRYPTO_KEY_HASH_ALGORITHM_CONF_KEY, CRYPTO_KEY_HASH_ALGORITHM_CONF_DEFAULT); }
Source:
<code><START> public void writeToAllNonTxStores(MarshalledEntry marshalledEntry, AccessMode accessMode) { <END> storesMutex.readLock().lock(); try { writers.stream().filter(canPerform(accessMode)).forEach(writer -> writer.write(marshalledEntry)); } finally { storesMutex.readLock().unlock(); } }</code><technical_language>reserve word for methods work tx non-tx stores</technical_language>

Target:
public void writeToAllNonTxStores(MarshalledEntry marshalledEntry, AccessMode accessMode) { storesMutex.readLock().lock(); try { nonTxWriters.stream() .filter(writer -> accessMode.canPerform(configMap.get(writer))) .forEach(writer -> writer.write(marshalledEntry)); } finally { storesMutex.readLock().unlock(); } }
Source:
<code>public <START> boolean isMirroringEnabled() <END> { return fMirroringEnabled; }</code><technical_language>final</technical_language>

Target:
public final boolean isMirroringEnabled() { return fMirroringEnabled; }
Source:
<code>public Builder setAdUiElements(Set<UiElement> adUiElements) { <START> this.adUiElements = Assertions.checkNotNull(adUiElements); <END> return this; }</code><technical_language>worth storing a copy of set, in case application modifies it</technical_language>

Target:
public Builder setAdUiElements(Set<UiElement> adUiElements) { this.adUiElements = new HashSet<>(Assertions.checkNotNull(adUiElements)); return this; }
Source:
<code>private static String getProxyType(String protocol) { protocol = protocol.trim().toLowerCase(Locale.ENGLISH); String type; if (protocol <START> != null) <END> { throw new IllegalArgumentException("unknown proxy protocol: " + protocol); } else switch (protocol) { case "http": type = IProxyData.HTTP_PROXY_TYPE; break; case "https": type = IProxyData.HTTPS_PROXY_TYPE; break; case "socks4": case "socks_5": type = IProxyData.SOCKS_PROXY_TYPE; break; default: throw new IllegalArgumentException("unknown proxy protocol: " + protocol); } return type; }</code><technical_language>Please do so</technical_language>

Target:
private static String getProxyType(String protocol) { protocol = protocol.trim().toLowerCase(Locale.ENGLISH); String type; if (protocol == null) { throw new IllegalArgumentException("unknown proxy protocol: " + protocol); } switch (protocol) { case "http": type = IProxyData.HTTP_PROXY_TYPE; break; case "https": type = IProxyData.HTTPS_PROXY_TYPE; break; case "socks4": case "socks_5": type = IProxyData.SOCKS_PROXY_TYPE; break; default: throw new IllegalArgumentException("unknown proxy protocol: " + protocol); } return type; }
Source:
<code>public void stop() { LogManager.d(TAG, "stop called"); mScanningEnabled = false; if (mScanCyclerStarted) { scanLeDevice(false); LogManager.d(TAG, "forcing scanning to stop even for devices capable of multiple detections per cycle"); <START> stopScan(); <END> } else { LogManager.d(TAG, "scanning already stopped"); } }</code><technical_language>is stopScan() required here? call scanLeDevice(false) call it</technical_language>

Target:
public void stop() { LogManager.d(TAG, "stop called"); mScanningEnabled = false; if (mScanCyclerStarted) { scanLeDevice(false); } else { LogManager.d(TAG, "scanning already stopped"); } }
Source:
<code>public Contents toContents() throws RuntimeException { <START> if(isPrefix()) { <END> throw new RuntimeException("Could not create Contents"); } final Contents contents = new Contents(); contents.setETag(eTag); contents.setKey(key); contents.setLastModified(lastModified); contents.setOwner(owner); contents.setSize(size); contents.setStorageClass(storageClass); return contents; }</code><technical_language>Missing a space if (</technical_language>

Target:
public Contents toContents() throws RuntimeException { if (isPrefix()) { throw new UnabledToConvertToContentsException("Could not create a Contents"); } final Contents contents = new Contents(); contents.setETag(eTag); contents.setKey(key); contents.setLastModified(lastModified); contents.setOwner(owner); contents.setSize(size); contents.setStorageClass(storageClass); return contents; }
Source:
<code>public FunctionReference(MethodHandle handle, String[] parameterNames) { if (handle == null) { throw new IllegalArgumentException("A method handle cannot be null"); } this.handle = handle; <START> if (parameterNames != null) { <END> this.parameterNames = Arrays.copyOf(parameterNames, parameterNames.length); } else { this.parameterNames = new String[0]; } }</code><technical_language>unsure a defensive copy is helpful. In regular Java code I yes, array is private, values runtime bootstrap. case of null is good, again, is worth allocating array</technical_language>

Target:
public FunctionReference(MethodHandle handle, String[] parameterNames) { if (handle == null) { throw new IllegalArgumentException("A method handle cannot be null"); } this.handle = handle; this.parameterNames = parameterNames; }
Source:
<code>public List<ChannelDef> getChannels() { <START> return channels; <END> }</code><technical_language>Please a defensive copy of list returning avoid side-effects this class potential mutations of list caller. Ideally, return a Collections.unmodifiableList(channels)</technical_language>

Target:
public List<ChannelDef> getChannels() { return Collections.unmodifiableList(channels); }
Source:
<code>public static String eval(String toEval) throws CoreException { IEclipsePreferences node = DefaultScope.INSTANCE .getNode(IRPMConstants.RPM_CORE_ID); String rpmCmd = node.get(IRPMConstants.RPM_CMD, ""); List<String> command = new ArrayList<String>(); command.add(rpmCmd); command.add("--eval"); command.add(toEval); <START> IWorkbenchPage page = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage(); <END> ISelection selection = page.getSelection(); if(selection instanceof ITreeSelection){ Object element = ((ITreeSelection)selection).getFirstElement(); if(element instanceof IFile){ IProject project = ((IFile)element).getProject(); if(project.getLocationURI().toString().contains(":")) { try { return Utils.runCommandToString(project, command.toArray(new String[command.size()])); } catch (IOException e) { throw new CoreException(new Status(IStatus.ERROR, IRPMConstants.RPM_CORE_ID, e.getMessage(), e)); } } } } try { return Utils.runCommandToString(command.toArray(new String[command.size()])); } catch (IOException e) { throw new CoreException(new Status(IStatus.ERROR, IRPMConstants.RPM_CORE_ID, e.getMessage(), e)); } }</code><technical_language>I this properly handle case tree element selected in active page correspond element is evaluated, if tree element is selected eval done remotely. I needs a nicer determine eval done locally a remote system</technical_language>

Target:
public static String eval(String toEval) throws CoreException { IEclipsePreferences node = DefaultScope.INSTANCE .getNode(IRPMConstants.RPM_CORE_ID); String rpmCmd = node.get(IRPMConstants.RPM_CMD, ""); List<String> command = new ArrayList<String>(); command.add(rpmCmd); command.add("--eval"); command.add(toEval); try { return Utils.runCommandToString(command.toArray(new String[command.size()])); } catch (IOException e) { throw new CoreException(new Status(IStatus.ERROR, IRPMConstants.RPM_CORE_ID, e.getMessage(), e)); } }
Source:
<code>public void closedLow(boolean closedLow) { <START> this.closedLow = closedLow == true; <END> }</code><technical_language>simply this.closedLow = closedLow enough</technical_language>

Target:
public void closedLow(boolean closedLow) { this.closedLow = closedLow; }
Source:
<code>private static long convert(final String capacity, final MemoryUnit designatedUnit) { long number = parseCapacityValue(capacity); MemoryUnit currentUnit = parseCapacityUnit(capacity); <START> long bytes = Math.multiplyExact(number, currentUnit.getFactor()); <END> if ( bytes % designatedUnit.getFactor() == 0L ) { return bytes / designatedUnit.getFactor(); } return 0L; }</code><technical_language>some log warning message identifying convertable</technical_language>

Target:
private static long convert(final String capacity, final MemoryUnit designatedUnit) { long number = parseCapacityValue(capacity); MemoryUnit currentUnit = parseCapacityUnit(capacity); long bytes = Math.multiplyExact(number, currentUnit.getFactor()); if ( bytes % designatedUnit.getFactor() == 0L ) { return bytes / designatedUnit.getFactor(); } LOGGER.warn("Could not convert capacity: to unit {}", capacity, designatedUnit); return 0L; }
Source:
<code>public void createGroupInAwsRegion(ComputeServiceContext computeServiceContext, String region) { AWSEC2Api ec2Client = computeServiceContext.unwrapApi(AWSEC2Api.class); <START> String sgId = ec2Client.getSecurityGroupApi().get().createSecurityGroupInRegionAndReturnId("us-east-1", "br-JBoss-appId123-entId123-uid1234-sg", "security group for XXX"); <END> ec2Client.getSecurityGroupApi().get().authorizeSecurityGroupIngressInRegion("us-east-1", sgId, ipPerms); }</code><technical_language>Hard-coded values. "us-east-1" region (and line below). security group name hard-coded - callgetName()</technical_language>

Target:
public void createGroupInAwsRegion(ComputeServiceContext computeServiceContext, String region) { AWSEC2Api ec2Client = computeServiceContext.unwrapApi(AWSEC2Api.class); String sgId = ec2Client.getSecurityGroupApi().get().createSecurityGroupInRegionAndReturnId(region, getName(), "Brooklyn-managed security group "+getName()); ec2Client.getSecurityGroupApi().get().authorizeSecurityGroupIngressInRegion(region, sgId, ipPerms); }
Source:
<code>protected void runAutonomous() throws InterruptedException, AutonomousModeOverException { pickupContainer(nudge.get()); DriveCode.octocanumShifting.set(true); <START> strafe(STRAFE_RIGHT, leftStrafeTime.get()); <END> DriveCode.octocanumShifting.set(false); drive(autoZoneDistance.get()); depositContainer(); drive(-autoZoneDistance.get()); }</code><technical_language>STRAFE_RIGHT</technical_language>

Target:
protected void runAutonomous() throws InterruptedException, AutonomousModeOverException { pickupContainer(nudge.get()); DriveCode.octocanumShifting.set(true); strafe(STRAFE_LEFT, leftStrafeTime.get()); DriveCode.octocanumShifting.set(false); drive(autoZoneDistance.get()); depositContainer(); drive(-autoZoneDistance.get()); }
Source:
<code>public void testCreateDirectories() throws IOException { <START> Path testBaseDirectoryPath = Paths.get("src/test/resources"); <END> Path firstDirectoryOfTestPath = testBaseDirectoryPath.resolve("several"); if (Files.isDirectory(firstDirectoryOfTestPath)) { TreeDeleter.deltree(firstDirectoryOfTestPath); } String testBaseDirectoryURI = testBaseDirectoryPath.toUri().toString(); String createDirectories = "several/directories/can/be/created/at/once"; new FileService().createDirectories(URI.create(testBaseDirectoryURI + createDirectories)); assertTrue(Files.isDirectory(firstDirectoryOfTestPath.resolve("directories/can/be/created/at/once"))); TreeDeleter.deltree(firstDirectoryOfTestPath); }</code><technical_language>config file</technical_language>

Target:
public void testCreateDirectories() throws IOException { ServiceManager.getFileService().createDirectories(URI.create("several/directories/can/be/created/at/once")); assertTrue(ServiceManager.getFileService().isDirectory(URI.create(SEVERAL))); cleanUp(); }
Source:
<code>public void execute() throws FluoCommandException { <START> config(); <END> }</code><technical_language>inlined</technical_language>

Target:
public void execute() throws FluoCommandException { FluoConfiguration config = getConfig(); CommandUtil.verifyAppInitialized(config); try (FluoAdmin admin = FluoFactory.newAdmin(config)) { for (Map.Entry<String, String> entry : admin.getApplicationConfig().toMap().entrySet()) { System.out.println(entry.getKey() + " = " + entry.getValue()); } } }
Source:
<code>public PigSchemaConverter(boolean columnIndexAccess) { <START> this.columnIndexAccess = columnIndexAccess; <END> }</code><technical_language>declaring interface for behavior controlled coulumnIndexAccess? interface ColumnsAccess { ... } in constructor : this.columnAccess = columnIndexAccess ? new ColumnsAccess () { ... index based logic } : new ColumnsAccess () { ... name based logic } avoid if (columnIndexAccess) in places</technical_language>

Target:
public PigSchemaConverter(boolean columnIndexAccess) { this.columnAccess = columnIndexAccess?new ColumnIndexAccess():new ColumnNameAccess(); }
Source:
<code><START> private static Map<String, Symbol> getModuleSymbols(String moduleName, String categoryPath, Map<String, Set<Symbol>> initialSymbols) { <END> ModuleDescription moduleDescription = getResourceForModule(moduleName, categoryPath); if (moduleDescription == null) { return Collections.emptyMap(); } PythonFile file = new TypeShedPythonFile(moduleDescription.resource, moduleDescription.fileName); AstNode astNode = PythonParser.create().parse(file.content()); FileInput fileInput = new PythonTreeMaker().fileInput(astNode); new SymbolTableBuilder(moduleDescription.packageName, file, initialSymbols).visitFileInput(fileInput); fileInput.accept(new ReturnTypeVisitor()); return fileInput.globalVariables().stream() .map(symbol -> { ((SymbolImpl) symbol).removeUsages(); return symbol; }) .filter(s -> s.fullyQualifiedName() != null && s.fullyQualifiedName().startsWith(moduleName)) .collect(Collectors.toMap(Symbol::fullyQualifiedName, Function.identity())); }</code><technical_language>a case aimed support I a problem nested packages here. If import lib2to3.pgen2, expect resolve typeshed/stdlib/2and3/lib2to3/pgen2/__init__.pyi instead typeshed/stdlib/2and3/lib2to3.pgen2/__init__.pyi missing related symbols</technical_language>

Target:
private static Map<String, Symbol> getModuleSymbols(String moduleName, String categoryPath, Map<String, Set<Symbol>> initialSymbols) { ModuleDescription moduleDescription = getResourceForModule(moduleName, categoryPath); if (moduleDescription == null) { return Collections.emptyMap(); } PythonFile file = new TypeShedPythonFile(moduleDescription.resource, moduleDescription.fileName); AstNode astNode = PythonParser.create().parse(file.content()); FileInput fileInput = new PythonTreeMaker().fileInput(astNode); new SymbolTableBuilder(moduleDescription.packageName, file, ProjectLevelSymbolTable.from(initialSymbols)).visitFileInput(fileInput); fileInput.accept(new ReturnTypeVisitor()); return fileInput.globalVariables().stream() .map(symbol -> { ((SymbolImpl) symbol).removeUsages(); return symbol; }) .filter(s -> s.fullyQualifiedName() != null) .collect(Collectors.toMap(Symbol::fullyQualifiedName, Function.identity(), AmbiguousSymbolImpl::create)); }
Source:
<code>protected IndentLevel getIndentImpl() { if (getParent() instanceof MethodCallHandler) { return getParent().getSuggestedChildIndent(this); } DetailAST parent = getMainAst().getParent(); if (getParent() instanceof NewHandler) { <START> isLambdaCorrectlyIndented = false; <END> parent = parent.getParent(); } IndentLevel level = new IndentLevel(getLineStart(parent)); final DetailAST firstChild = getMainAst().getFirstChild(); if (getLineStart(firstChild) == expandedTabsColumnNo(firstChild)) { level = new IndentLevel(level, getIndentCheck().getLineWrappingIndentation()); } return level; }</code><technical_language>This new field final is assigned in constructor. means flip constructor, flipped in multiple areas. Is usage of this field in method true path another method false path, re-calling method mentioned false path 2nd time through? If this is lead some randomness issues in check a run</technical_language>

Target:
protected IndentLevel getIndentImpl() { if (getParent() instanceof MethodCallHandler) { return getParent().getSuggestedChildIndent(this); } DetailAST parent = getMainAst().getParent(); if (getParent() instanceof NewHandler) { parent = parent.getParent(); } IndentLevel level = new IndentLevel(getLineStart(parent)); final DetailAST firstChild = getMainAst().getFirstChild(); if (getLineStart(firstChild) == expandedTabsColumnNo(firstChild)) { level = new IndentLevel(level, getIndentCheck().getLineWrappingIndentation()); } return level; }
Source:
<code>private TypeSpec getNullSharedTriggers(TypeName sharedTriggersInterfaceType) { TypeSpec.Builder nullSharedTriggersClassBuilder = TypeSpec.classBuilder("NullSharedTriggers") .addModifiers(Modifier.PUBLIC, Modifier.ABSTRACT, Modifier.STATIC) .addSuperinterface(sharedTriggersInterfaceType); for (Entry<String, TableDefinition> entry : definitions.entrySet()) { String name = entry.getKey(); TableDefinition tableDefinition = entry.getValue(); String tableName = getTableName(name); TypeName rowType = ClassName.get(packageName, tableName + "." + name + "Row"); TypeName columnType = ClassName.get(packageName, tableName + "." + name + "ColumnValue"); if (!tableDefinition.toTableMetadata().getColumns().hasDynamicColumns()) { columnType = ParameterizedTypeName.get( ClassName.get(packageName, tableName + "." + name + "NamedColumnValue"), <START> WildcardTypeName.subtypeOf(Object.class)); <END> } MethodSpec putMethod = MethodSpec.methodBuilder("put" + name) .addAnnotation(Override.class) .addModifiers(Modifier.PUBLIC) .addParameter( ParameterizedTypeName.get( ClassName.get(Multimap.class), rowType, WildcardTypeName.subtypeOf(columnType) ), "newRows") .addComment("do nothing") .build(); nullSharedTriggersClassBuilder .addMethod(putMethod); } return nullSharedTriggersClassBuilder.build(); }</code><technical_language>need some of logic for generating interface methods themselves, extract this logic implementing code generation</technical_language>

Target:
private TypeSpec getNullSharedTriggers(TypeName sharedTriggersInterfaceType) { TypeSpec.Builder nullSharedTriggersClassBuilder = TypeSpec.classBuilder("NullSharedTriggers") .addModifiers(Modifier.PUBLIC, Modifier.ABSTRACT, Modifier.STATIC) .addSuperinterface(sharedTriggersInterfaceType); for (Entry<String, TableDefinition> entry : definitions.entrySet()) { String name = entry.getKey(); TableDefinition tableDefinition = entry.getValue(); String tableName = getTableName(name); ClassName tableType = ClassName.get(packageName, tableName); TypeName rowType = tableType.nestedClass(name + "Row"); TypeName columnType = tableType.nestedClass(name + "ColumnValue"); if (!tableDefinition.toTableMetadata().getColumns().hasDynamicColumns()) { columnType = ParameterizedTypeName.get( ClassName.get(packageName, tableName + "." + name + "NamedColumnValue"), WildcardTypeName.subtypeOf(Object.class)); } MethodSpec putMethod = MethodSpec.methodBuilder("put" + name) .addAnnotation(Override.class) .addModifiers(Modifier.PUBLIC) .addParameter( ParameterizedTypeName.get( ClassName.get(Multimap.class), rowType, WildcardTypeName.subtypeOf(columnType) ), "newRows") .addComment("do nothing") .build(); nullSharedTriggersClassBuilder .addMethod(putMethod); } return nullSharedTriggersClassBuilder.build(); }
Source:
<code>private static Group createGroup(final Composite parent, final String name) { <START> Group group = new Group(parent, SWT.NONE); <END> group.setText(name); GridLayout layout = new GridLayout(1, true); layout.marginHeight = 5; layout.marginWidth = 5; group.setLayout(layout); GridData data = new GridData(SWT.FILL, SWT.FILL, true, true); group.setLayoutData(data); return group; }</code><technical_language>final</technical_language>

Target:
private static Group createGroup(final Composite parent, final String name) { final Group group = new Group(parent, SWT.NONE); group.setText(name); final GridLayout layout = new GridLayout(1, true); layout.marginHeight = 5; layout.marginWidth = 5; group.setLayout(layout); final GridData data = new GridData(SWT.FILL, SWT.FILL, true, true); group.setLayoutData(data); return group; }
Source:
<code>PutManager(ClusterMap clusterMap, ResponseHandler responseHandler, NotificationSystem notificationSystem, RouterConfig routerConfig, NonBlockingRouterMetrics routerMetrics, OperationCompleteCallback operationCompleteCallback, ReadyForPollCallback readyForPollCallback, int index, Time time) { this.clusterMap = clusterMap; this.responseHandler = responseHandler; this.notificationSystem = notificationSystem; this.routerConfig = routerConfig; this.routerMetrics = routerMetrics; this.operationCompleteCallback = operationCompleteCallback; this.readyForPollCallback = readyForPollCallback; this.chunkArrivalListener = new ByteBufferAsyncWritableChannel.ChannelEventListener() { @Override public void onEvent(ByteBufferAsyncWritableChannel.EventType e) { <START> synchronized (chunkFillerSynchronizer) { <END> areChunksAvailableForFilling = true; if (isChunkFillerThreadAsleep) { chunkFillerSynchronizer.notify(); } } } }; this.time = time; putOperations = Collections.newSetFromMap(new ConcurrentHashMap<PutOperation, Boolean>()); correlationIdToPutOperation = new HashMap<Integer, PutOperation>(); chunkFillerThread = Utils.newThread("ChunkFillerThread-" + index, new ChunkFiller(), true); chunkFillerThread.start(); routerMetrics.initializePutManagerMetrics(chunkFillerThread); }</code><technical_language>do need wake for types of events</technical_language>

Target:
PutManager(ClusterMap clusterMap, ResponseHandler responseHandler, NotificationSystem notificationSystem, RouterConfig routerConfig, NonBlockingRouterMetrics routerMetrics, OperationCompleteCallback operationCompleteCallback, ReadyForPollCallback readyForPollCallback, int index, Time time) { this.clusterMap = clusterMap; this.responseHandler = responseHandler; this.notificationSystem = notificationSystem; this.routerConfig = routerConfig; this.routerMetrics = routerMetrics; this.operationCompleteCallback = operationCompleteCallback; this.readyForPollCallback = readyForPollCallback; this.chunkArrivalListener = new ByteBufferAsyncWritableChannel.ChannelEventListener() { @Override public void onEvent(ByteBufferAsyncWritableChannel.EventType e) { synchronized (chunkFillerSynchronizer) { chunkFillerThreadMaySleep = false; if (isChunkFillerThreadAsleep) { chunkFillerSynchronizer.notify(); } } } }; this.time = time; putOperations = Collections.newSetFromMap(new ConcurrentHashMap<PutOperation, Boolean>()); correlationIdToPutOperation = new HashMap<Integer, PutOperation>(); chunkFillerThread = Utils.newThread("ChunkFillerThread-" + index, new ChunkFiller(), true); chunkFillerThread.start(); routerMetrics.initializePutManagerMetrics(chunkFillerThread); }
Source:
<code>public ActionResult<ItemStack> onItemRightClick(@Nonnull ItemStack stack, World world, EntityPlayer player, EnumHand hand) { if(ToolHelper.isBroken(stack)) { return ActionResult.newResult(EnumActionResult.FAIL, stack); } <START> RayTraceResult trace = this.rayTrace(world, player, false); <END> if(trace == null || trace.typeOfHit != RayTraceResult.Type.BLOCK) { return ActionResult.newResult(EnumActionResult.PASS, stack); } int fortune = EnchantmentHelper.getEnchantmentLevel(Enchantments.FORTUNE, stack); BlockPos origin = trace.getBlockPos().offset(trace.sideHit); if(!harvestBlock(stack, world, player, origin, fortune)) { return ActionResult.newResult(EnumActionResult.PASS, stack); } for(BlockPos pos : ((IAoeTool) this).getAOEBlocks(stack, player.worldObj, player, origin)) { harvestBlock(stack, world, player, pos, fortune); } player.worldObj.playSound(null, player.posX, player.posY, player.posZ, SoundEvents.ENTITY_PLAYER_ATTACK_SWEEP, player.getSoundCategory(), 1.0F, 1.0F); player.spawnSweepParticles(); return ActionResult.newResult(player.worldObj.isRemote ? EnumActionResult.PASS : EnumActionResult.SUCCESS, stack); }</code><technical_language>This needs pass true parameter stops crops (non-opaque-solid blocks)</technical_language>

Target:
public ActionResult<ItemStack> onItemRightClick(@Nonnull ItemStack stack, World world, EntityPlayer player, EnumHand hand) { if(ToolHelper.isBroken(stack)) { return ActionResult.newResult(EnumActionResult.FAIL, stack); } RayTraceResult trace = this.rayTrace(world, player, true); if(trace == null || trace.typeOfHit != RayTraceResult.Type.BLOCK) { return ActionResult.newResult(EnumActionResult.PASS, stack); } int fortune = EnchantmentHelper.getEnchantmentLevel(Enchantments.FORTUNE, stack); BlockPos origin = trace.getBlockPos(); IBlockState state = world.getBlockState(origin); if(!ToolHelper.isToolEffective2(stack, state) || state.getBlockHardness(world, origin) > 0) { return ActionResult.newResult(EnumActionResult.PASS, stack); } for(BlockPos pos : this.getAOEBlocks(stack, player.worldObj, player, origin)) { harvestCrop(stack, world, player, pos, fortune); } harvestCrop(stack, world, player, origin, fortune); player.worldObj.playSound(null, player.posX, player.posY, player.posZ, SoundEvents.ENTITY_PLAYER_ATTACK_SWEEP, player.getSoundCategory(), 1.0F, 1.0F); player.spawnSweepParticles(); return ActionResult.newResult(player.worldObj.isRemote ? EnumActionResult.PASS : EnumActionResult.SUCCESS, stack); }
Source:
<code><START> public boolean hasColumns() { <END> return !storageFields.isEmpty(); }</code><technical_language>this method final</technical_language>

Target:
public final boolean hasColumns() { return !storageFields.isEmpty(); }
Source:
<code>public void errorFlowAndRetries() throws Exception { delayHandler.setDefaultDelay(10); delayHandler.setRetryDelay(15); startDelayerHandler(); Message<?> message = MessageBuilder.withPayload("test").build(); final CountDownLatch latch = new CountDownLatch(1); delayHandler.setDelayedMessageErrorChannel((m, t) -> { if (StaticMessageHeaderAccessor.getDeliveryAttempt(m).get() < 4) { throw new RuntimeException("fail"); } latch.countDown(); return true; }); delayHandler.setOutputChannel((m, t) -> { throw new RuntimeException("fail"); }); <START> input.send(message); <END> }</code><technical_language>Is test finished? I assertions here</technical_language>

Target:
public void errorFlowAndRetries() throws Exception { delayHandler.setDefaultDelay(10); delayHandler.setRetryDelay(15); startDelayerHandler(); Message<?> message = MessageBuilder.withPayload("test") .setHeader("foo", new AtomicInteger()) .build(); final CountDownLatch latch = new CountDownLatch(1); final AtomicInteger count = new AtomicInteger(); delayHandler.setDelayedMessageErrorChannel((m, t) -> { count.incrementAndGet(); int deliveries = StaticMessageHeaderAccessor.getDeliveryAttempt(m).get(); ((MessagingException) m.getPayload()).getFailedMessage().getHeaders().get("foo", AtomicInteger.class) .incrementAndGet(); if (deliveries < 3) { throw new RuntimeException("fail"); } else if (deliveries == 3) { return false; } else { latch.countDown(); return true; } }); delayHandler.setOutputChannel((m, t) -> { throw new MessagingException(m); }); input.send(message); assertTrue(latch.await(10, TimeUnit.SECONDS)); Thread.sleep(50); assertThat(count.get(), equalTo(4)); assertThat(TestUtils.getPropertyValue(this.delayHandler, "deliveries", Map.class).size(), equalTo(0)); }
Source:
<code>public void testDispatch() throws InterruptedException { DebugPlugin debugPlugin = new DebugPlugin(); StaticPluginLocator<? extends DAGExecutionPlugin> locator = new StaticPluginLocator<>(debugPlugin); ApexPluginDispatcher pluginManager = new DefaultApexPluginDispatcher(locator, new StramTestSupport.TestAppContext(new Attribute.AttributeMap.DefaultAttributeMap()), null, null); pluginManager.init(new Configuration()); pluginManager.dispatch(STRAM_EVENT, new StramEvent(StramEvent.LogLevel.DEBUG) { @Override public String getType() { return "TestEvent"; } }); pluginManager.dispatch(COMMIT_EVENT, new Long(1234)); pluginManager.dispatch(HEARTBEAT, new StreamingContainerUmbilicalProtocol.ContainerHeartbeat()); <START> debugPlugin.waitForEventDelivery(); <END> pluginManager.stop(); Assert.assertEquals(1, debugPlugin.getEventCount()); Assert.assertEquals(1, debugPlugin.getHeartbeatCount()); Assert.assertEquals(1, debugPlugin.getCommitCount()); }</code><technical_language>Pass timeout parameter</technical_language>

Target:
public void testDispatch() throws InterruptedException { DebugPlugin debugPlugin = new DebugPlugin(); StaticPluginLocator<? extends DAGExecutionPlugin> locator = new StaticPluginLocator<>(debugPlugin); ApexPluginDispatcher pluginManager = new DefaultApexPluginDispatcher(locator, new StramTestSupport.TestAppContext(new Attribute.AttributeMap.DefaultAttributeMap()), null, null); pluginManager.init(new Configuration()); pluginManager.dispatch(STRAM_EVENT, new StramEvent(StramEvent.LogLevel.DEBUG) { @Override public String getType() { return "TestEvent"; } }); pluginManager.dispatch(COMMIT_EVENT, new Long(1234)); pluginManager.dispatch(HEARTBEAT, new StreamingContainerUmbilicalProtocol.ContainerHeartbeat()); debugPlugin.waitForEventDelivery(10); pluginManager.stop(); Assert.assertEquals(1, debugPlugin.getEventCount()); Assert.assertEquals(1, debugPlugin.getHeartbeatCount()); Assert.assertEquals(1, debugPlugin.getCommitCount()); }
Source:
<code>public void set(double speed) { LogKitten.v("Motor " + getName() + " @ " + speed); double newSpeed = speedModifier.modify(speed); lastSpeed = newSpeed; <START> for (CustomSpeedController motor : motors) { <END> motor.set(newSpeed); } }</code><technical_language>SpeedController CustomSpeedController</technical_language>

Target:
public void set(double speed) { LogKitten.v("Motor " + getName() + " @ " + speed); double newSpeed = speedModifier.modify(speed); lastSpeed = newSpeed; for (SpeedController motor : motors) { motor.set(newSpeed); } }
Source:
<code>public Object[] getElements(Object inputElement) { List<RepositoryTreeNode> nodes = new ArrayList<>(); List<String> directories = new ArrayList<>(); RepositoryUtil repositoryUtil = Activator.getDefault() .getRepositoryUtil(); <START> boolean useRepositoryGroups = showUnbornHead; <END> RepositoryGroups groups = new RepositoryGroups(); if (inputElement instanceof Collection) { for (Object next : ((Collection) inputElement)) { if (next instanceof RepositoryTreeNode) { nodes.add((RepositoryTreeNode) next); } else if (next instanceof String) { directories.add((String) next); } } } else if (inputElement instanceof IWorkspaceRoot) { directories.addAll(repositoryUtil.getConfiguredRepositories()); } for (String directory : directories) { try { File gitDir = new File(directory); if (gitDir.exists()) { if (!useRepositoryGroups || !groups.belongsToGroup(directory)) { RepositoryNode rNode = new RepositoryNode(null, repositoryCache.lookupRepository(gitDir)); nodes.add(rNode); } } else repositoryUtil.removeDir(gitDir); } catch (IOException e) { } } if (useRepositoryGroups) { for (RepositoryGroup group : groups.getGroups()) { nodes.add(new RepositoryGroupNode(null, group)); } } Collections.sort(nodes); return nodes.toArray(); }</code><technical_language>showing repo groups do showing unborn head? "showUnbornHead" needs renamed. I wondering if groups shown (repo selection dialog)</technical_language>

Target:
public Object[] getElements(Object inputElement) { List<RepositoryTreeNode> nodes = new ArrayList<>(); List<String> directories = new ArrayList<>(); RepositoryUtil repositoryUtil = Activator.getDefault() .getRepositoryUtil(); RepositoryGroups groups = new RepositoryGroups(); if (inputElement instanceof Collection) { for (Object next : ((Collection) inputElement)) { if (next instanceof RepositoryTreeNode) { nodes.add((RepositoryTreeNode) next); } else if (next instanceof String) { directories.add((String) next); } } } else if (inputElement instanceof IWorkspaceRoot) { directories.addAll(repositoryUtil.getConfiguredRepositories()); } nodes.addAll( getRepositoryNodes(repositoryUtil, groups, null, directories)); if (showRepositoryGroups) { for (RepositoryGroup group : groups.getGroups()) { nodes.add(new RepositoryGroupNode(group)); } } Collections.sort(nodes); return nodes.toArray(); }
Source:
<code>private static CheckpointBarrierHandler createCheckpointBarrierHandler( StreamConfig config, IntStream numberOfInputChannelsPerGate, ChannelStateWriter channelStateWriter, String taskName, InputGate[] channelIndexToInputGate, Map<InputGate, Integer> inputGateToChannelIndexOffset, AbstractInvokable toNotifyOnCheckpoint) { switch (config.getCheckpointMode()) { case EXACTLY_ONCE: <START> return config.isUnalignedCheckpointsEnabled() ? <END> new AlternatingCheckpointBarrierHandler( new CheckpointBarrierAligner( taskName, channelIndexToInputGate, inputGateToChannelIndexOffset, toNotifyOnCheckpoint), new CheckpointBarrierUnaligner( numberOfInputChannelsPerGate.toArray(), channelStateWriter, taskName, toNotifyOnCheckpoint), toNotifyOnCheckpoint) : new CheckpointBarrierAligner( taskName, channelIndexToInputGate, inputGateToChannelIndexOffset, toNotifyOnCheckpoint); case AT_LEAST_ONCE: return new CheckpointBarrierTracker(numberOfInputChannelsPerGate.sum(), toNotifyOnCheckpoint); default: throw new UnsupportedOperationException("Unrecognized Checkpointing Mode: " + config.getCheckpointMode()); } }</code><technical_language>ternary is making easier here</technical_language>

Target:
private static CheckpointBarrierHandler createCheckpointBarrierHandler( StreamConfig config, IntStream numberOfInputChannelsPerGate, ChannelStateWriter channelStateWriter, String taskName, InputGate[] channelIndexToInputGate, Map<InputGate, Integer> inputGateToChannelIndexOffset, AbstractInvokable toNotifyOnCheckpoint) { switch (config.getCheckpointMode()) { case EXACTLY_ONCE: if (config.isUnalignedCheckpointsEnabled()) { return new AlternatingCheckpointBarrierHandler( new CheckpointBarrierAligner( taskName, channelIndexToInputGate, inputGateToChannelIndexOffset, toNotifyOnCheckpoint), new CheckpointBarrierUnaligner( numberOfInputChannelsPerGate.toArray(), channelStateWriter, taskName, toNotifyOnCheckpoint), toNotifyOnCheckpoint); } return new CheckpointBarrierAligner( taskName, channelIndexToInputGate, inputGateToChannelIndexOffset, toNotifyOnCheckpoint); case AT_LEAST_ONCE: return new CheckpointBarrierTracker(numberOfInputChannelsPerGate.sum(), toNotifyOnCheckpoint); default: throw new UnsupportedOperationException("Unrecognized Checkpointing Mode: " + config.getCheckpointMode()); } }
Source:
<code>public void updateVisibility() { messageLabel.setVisible(false); externalLabel.setVisible(ApplicationModeHelper.isModeSupported(ApplicationMode.VirtOnly)); <START> onPhysicalNetworkChange(); <END> }</code><technical_language>Continuation of comme?t line #242 - Please notice 'messageLabel' 'externalLabel' representation in model. fields manipulating in 'onPhysicalNetworkChange()' do have, please move this logic model</technical_language>

Target:
public void updateVisibility() { messageLabel.setVisible(false); externalLabel.setVisible(ApplicationModeHelper.isModeSupported(ApplicationMode.VirtOnly)); physicalNetworkLabel.setVisible(false); }
Source:
<code><START> public boolean equals(Object obj) { <END> if (this == obj) return true; if (obj == null) return false; if (getClass() != obj.getClass()) return false; ListenerSubscription other = (ListenerSubscription) obj; if (indexer == null) { if (other.indexer != null) return false; } else if (!indexer.equals(other.indexer)) return false; if (listener == null) { if (other.listener != null) return false; } else if (!listener.equals(other.listener)) return false; return true; }</code><technical_language>Consider Objects#equals(o1, o2) in this method. I believe, result more readable, handles null parameters properly</technical_language>

Target:
public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (getClass() != obj.getClass()) return false; ListenerSubscription other = (ListenerSubscription) obj; return Objects.equals(listener, other.listener) && Objects.equals(indexer, other.indexer); }
Source:
<code>public ClientConfiguration getClientConfiguration() { <START> return clientConfiguration; <END> }</code><technical_language>return a copy here</technical_language>

Target:
public ClientConfiguration getClientConfiguration() { return new ClientConfiguration(clientConfiguration); }
Source:
<code>public GrillSessionHandle openSession(String username, String password, Map<String, String> configuration) throws GrillException { GrillSessionHandle sessionid = super.openSession(username, password, configuration); String auxJars = getSession(sessionid).getSessionConf().get(GrillConfConstants.AUX_JARS); if (StringUtils.isNotBlank(auxJars)) { LOG.info("Adding aux jars:" + auxJars); <START> for (String jar : StringUtils.split(auxJars, ",")) { <END> addResource(sessionid, "jar", jar); } } return sessionid; }</code><technical_language>Is split required? a getStrings methods return array of strings</technical_language>

Target:
public GrillSessionHandle openSession(String username, String password, Map<String, String> configuration) throws GrillException { GrillSessionHandle sessionid = super.openSession(username, password, configuration); String[] auxJars = getSession(sessionid).getSessionConf().getStrings(GrillConfConstants.AUX_JARS); if (auxJars != null) { LOG.info("Adding aux jars:" + auxJars); for (String jar : auxJars) { addResource(sessionid, "jar", jar); } } return sessionid; }
Source:
<code>private String getName(HiveColumnHandle[] expectedColumns) { return Stream.of(expectedColumns) .map(HiveColumnHandle::getName) <START> .collect(Collectors.joining(",")); <END> }</code><technical_language>static import joining</technical_language>

Target:
private String getName(HiveColumnHandle[] expectedColumns) { return Stream.of(expectedColumns) .map(HiveColumnHandle::getName) .collect(joining(",")); }
Source:
<code>public CapraWordRequirement(XWPFParagraph paragraph, File officeFile, int objectID) { String rText = ""; String rId = ""; CTP pCtp = paragraph.getCTP(); Document doc; try { doc = loadXMLFromString(pCtp.toString()); } catch (Exception e) { e.printStackTrace(); return; } NodeList nodeList = doc.getElementsByTagName(wordFieldTag); if (nodeList.getLength() > 0) { String[] parts = nodeList.item(0).getTextContent().split(splitFieldRegex); if (Arrays.asList(parts).contains(fieldName) && parts.length > 2) { rText = paragraph.getText(); rId = parts[2].trim(); } } rText = rText.replaceAll(replaceRegex, " ").trim(); if (!rText.isEmpty()) { <START> String pUri = CapraOfficeObject.createUri(officeFile.getAbsolutePath(), rId); <END> this.setData(rText); this.setUri(pUri); } }</code><technical_language>Hand file do conversion (if needed) in CapraOfficeObject</technical_language>

Target:
public CapraWordRequirement(XWPFParagraph paragraph, File officeFile, int objectID) { String rText = ""; String rId = ""; CTP pCtp = paragraph.getCTP(); Document doc; try { doc = loadXMLFromString(pCtp.toString()); } catch (Exception e) { e.printStackTrace(); return; } NodeList nodeList = doc.getElementsByTagName(wordFieldTag); if (nodeList.getLength() > 0) { String[] parts = nodeList.item(0).getTextContent().split(splitFieldRegex); if (Arrays.asList(parts).contains(fieldName) && parts.length > 2) { rText = paragraph.getText(); rId = parts[2].trim(); } } rText = rText.replaceAll(replaceRegex, " ").trim(); if (!rText.isEmpty()) { String pUri = CapraOfficeObject.createUri(officeFile, rId); this.setData(rText); this.setUri(pUri); } }
Source:
<code>public static void evict(Configuration conf, Request request) { if (!HiveConf.getBoolVar(conf, HiveConf.ConfVars.LLAP_IO_PROACTIVE_EVICTION_ENABLED)) { return; } try { LlapRegistryService llapRegistryService = LlapRegistryService.getClient(conf); Collection<LlapServiceInstance> instances = llapRegistryService.getInstances().getAll(); if (instances.size() == 0) { return; } <START> ExecutorService executorService = Executors.newCachedThreadPool(); <END> for (LlapServiceInstance instance : instances) { Task task = new Task(conf, instance, request); executorService.execute(task); } } catch (IOException e) { throw new RuntimeException(e); } }</code><technical_language>This code multiple issues is safe. 1. issue, is explicit shutdown of executor is a big issue self, some implementations shutdown in a finalizer **BUT JVM spec do guaranteed call finalize()**. 2. this code is creating a thread pool call, is a huge resource wast. 3. point Threads named hard debug. 4. Fourth assume some of tasks hangs IO happen ? JVM stops ? 5. Nth issue Assume assume 500 llap nodes (yes cluster 500 node running), this fire 500 threads is ? IMO cut of this pr avoid this Async stuff start a simple version need a static fixed thread pool a defined **life cycle** clear strategy deal **blocking IO**, **errors** **shutdown**</technical_language>

Target:
public static void evict(Configuration conf, Request request) { if (!HiveConf.getBoolVar(conf, HiveConf.ConfVars.LLAP_IO_PROACTIVE_EVICTION_ENABLED)) { return; } try { LlapRegistryService llapRegistryService = LlapRegistryService.getClient(conf); Collection<LlapServiceInstance> instances = llapRegistryService.getInstances().getAll(); if (instances.size() == 0) { return; } LOG.info("Requesting proactive LLAP cache eviction."); if (LOG.isDebugEnabled()) { LOG.debug(request.toString()); } for (LlapServiceInstance instance : instances) { EvictionRequestTask task = new EvictionRequestTask(conf, instance, request); EXECUTOR.execute(task); } } catch (IOException e) { throw new RuntimeException(e); } }
Source:
<code>public String toString() { return "OperatingSystem{" + <START> "id='" + id + '\'' + <END> ", softwareLicense=" + softwareLicense + ", operatingSystemReferenceCode=" + operatingSystemReferenceCode + ", passwords=" + passwords + '}'; }</code><technical_language>[minor] single-quoting id</technical_language>

Target:
public String toString() { return Objects.toStringHelper(this) .add("id", id) .add("softwareLicense", softwareLicense) .add("operatingSystemReferenceCode", operatingSystemReferenceCode) .add("passwords", passwords) .toString(); }