auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public void _list(ListOptions options) throws Exception { <START> List<BundleDTO> installedBundles = agent.getBundles(); <END> installedBundles.forEach(this::prettyPrintBundleDTO); }</code><technical_language>add option get output in JSON</technical_language>

Target:
public void _list(ListOptions options) throws Exception { List<BundleDTO> installedBundles = agent.getBundles(); outputAs(options.json(), installedBundles); }
Source:
<code>private JComponent createDetailTextArea() { JPanel detailPanel = new JPanel(new BorderLayout()); JLabel detailLabel = new JLabel("Details"); detailPanel.add(detailLabel, BorderLayout.NORTH); <START> detailTextArea = new JTextArea(); <END> detailTextArea.setRows(4); detailTextArea.setEditable(false); detailPanel.add(detailTextArea, BorderLayout.SOUTH); return detailPanel; }</code><technical_language>constructor JTextArea(rows, columns), preferedSize is stable. preferedSize of component depends actual text in area time of layouting. This leads flickering layouts (when window is resized etc). I recommend: detailTextArea = new JTextArea(4, 80); // preferedSize is set for a text of 4 rows 80 chars row</technical_language>

Target:
private JComponent createDetailTextArea() { JPanel detailPanel = new JPanel(new BorderLayout()); JLabel detailLabel = new JLabel("Details"); detailPanel.add(detailLabel, BorderLayout.NORTH); detailTextArea = new JTextArea(4, 80); detailTextArea.setEditable(false); detailPanel.add(detailTextArea, BorderLayout.SOUTH); return detailPanel; }
Source:
<code>public void visitNode(Tree tree) { <START> if (!hasSemantic() || !(context instanceof AnalyzerMessageReporter)) { <END> return; } ClassTree classTree = (ClassTree) tree; String classPackageName = packageNameOf(classTree); Optional<AnnotationTree> componentScanAnnotation = classTree.modifiers().annotations().stream() .filter(SpringBeansShouldBeAccessibleCheck::isComponentScan).findFirst(); if (componentScanAnnotation.isPresent()) { componentScanAnnotation.get().arguments().forEach(this::addToScannedPackages); } else if (hasAnnotation(classTree, SPRING_BOOT_APP_ANNOTATION)) { scannedPackages.add(classPackageName); } else if (hasAnnotation(classTree, SPRING_BEAN_ANNOTATIONS)) { addMessageToMap(classPackageName, classTree); } }</code><technical_language>again, I drop test for type of context</technical_language>

Target:
public void visitNode(Tree tree) { ClassTree classTree = (ClassTree) tree; if (!hasSemantic() || classTree.simpleName() == null) { return; } String classPackageName = packageNameOf(classTree.symbol()); SymbolMetadata classSymbolMetadata = classTree.symbol().metadata(); List<SymbolMetadata.AnnotationValue> componentScanValues = classSymbolMetadata.valuesForAnnotation(COMPONENT_SCAN_ANNOTATION); if (componentScanValues != null) { componentScanValues.forEach(this::addToScannedPackages); } else if (hasAnnotation(classSymbolMetadata, SPRING_BOOT_APP_ANNOTATION)) { packagesScannedBySpring.add(classPackageName); } else if (hasAnnotation(classSymbolMetadata, SPRING_BEAN_ANNOTATIONS)) { addMessageToMap(classPackageName, classTree.simpleName()); } }
Source:
<code>public ChannelOptions(Credentials credential, String authority, String userAgent, String callTimingReportPath, String callStatusReportPath, RetryOptions unaryCallRetryOptions, ScheduledExecutorService scheduledExecutorService, long timeoutMs, int channelCount) { <START> Preconditions.checkArgument(!Strings.isNullOrEmpty(userAgent), <END> "UserAgent must not be empty or null"); this.credential = credential; this.authority = authority; this.userAgent = userAgent; this.callTimingReportPath = callTimingReportPath; this.callStatusReportPath = callStatusReportPath; this.scheduledExecutorService = scheduledExecutorService; this.unaryCallRetryOptions = unaryCallRetryOptions; this.timeoutMs = timeoutMs; this.channelCount = channelCount; }</code><technical_language>Some precondition checks in setter others in constructor. Consolidate</technical_language>

Target:
public ChannelOptions(Credentials credential, String authority, String userAgent, String callTimingReportPath, String callStatusReportPath, RetryOptions unaryCallRetryOptions, ScheduledExecutorService scheduledExecutorService, long timeoutMs, int channelCount) { Preconditions.checkArgument(!Strings.isNullOrEmpty(userAgent), "UserAgent must not be empty or null"); Preconditions.checkArgument(channelCount > 0, "Channel count has to be at least 1."); Preconditions.checkArgument(timeoutMs >= -1, "ChannelTimeoutMs has to be positive, or -1 for none."); this.credential = credential; this.authority = authority; this.userAgent = userAgent; this.callTimingReportPath = callTimingReportPath; this.callStatusReportPath = callStatusReportPath; this.scheduledExecutorService = scheduledExecutorService; this.unaryCallRetryOptions = unaryCallRetryOptions; this.timeoutMs = timeoutMs; this.channelCount = channelCount; }
Source:
<code>public static void setupJoysticks() { DriveCode.leftJoystickChannel = Igneous.joystick1.getYAxisSource(); DriveCode.rightJoystickChannel = Igneous.joystick1.getAxisSource(6); DriveCode.octocanumShifting = BooleanMixing.createDispatch(Igneous.joystick1.getButtonChannel(1), Igneous.globalPeriodic); Rollers.runRollersButton = BooleanMixing.createDispatch(Igneous.joystick2.getButtonChannel(3), Igneous.globalPeriodic); <START> Rollers.toggleRollersButton = BooleanMixing.createDispatch(Igneous.joystick2.getButtonChannel(4), Igneous.globalPeriodic); <END> }</code><technical_language>fact get pressed, consider passing Events instead of Booleans. (Igneous.joystick2.getButtonSource give EventInputs directly.)</technical_language>

Target:
public static void setupJoysticks() { DriveCode.leftJoystickChannel = Igneous.joystick1.getYAxisSource(); DriveCode.rightJoystickChannel = Igneous.joystick1.getAxisSource(6); DriveCode.octocanumShifting = BooleanMixing.createDispatch(Igneous.joystick1.getButtonChannel(1), Igneous.globalPeriodic); Rollers.runRollersButton = Igneous.joystick2.getButtonSource(3); Rollers.toggleRollersButton =Igneous.joystick2.getButtonSource(4); }
Source:
<code>public CCExport(String siteId, ContentHostingService contentHostingService) { this.siteId = siteId; this.contentService = contentHostingService; <START> this.messageForumsForumManager = ComponentManager.get(org.sakaiproject.api.app.messageforums.MessageForumsForumManager.class); <END> this.messageForumsMessageManager = ComponentManager.get(org.sakaiproject.api.app.messageforums.MessageForumsMessageManager.class); exportUtil = new ExportUtil(siteId); forumsExport = new ForumsExport(exportUtil, messageForumsForumManager, messageForumsMessageManager); }</code><technical_language>need fully qualified here</technical_language>

Target:
public CCExport(String siteId, ContentHostingService contentHostingService) throws IdUnusedException { this.siteId = siteId; this.contentService = contentHostingService; site = SiteService.getSite(siteId); this.messageForumsForumManager = ComponentManager.get(MessageForumsForumManager.class); this.messageForumsMessageManager = ComponentManager.get(MessageForumsMessageManager.class); exportUtil = new ExportUtil(siteId); forumsExport = new ForumsExport(exportUtil, messageForumsForumManager, messageForumsMessageManager); }
Source:
<code>private List<Brick> setupLegoEv3CategoryList() { List<Brick> legoEV3BrickList = new ArrayList<Brick>(); legoEV3BrickList.add(new LegoEv3MotorTurnAngleBrick(LegoEv3MotorTurnAngleBrick.Motor.MOTOR_A, BrickValues.LEGO_ANGLE)); legoEV3BrickList.add(new LegoEv3MotorMoveBrick(LegoEv3MotorMoveBrick.Motor.MOTOR_A, <START> BrickValues.LEGO_POWER)); <END> legoEV3BrickList.add(new LegoEv3MotorStopBrick(LegoEv3MotorStopBrick.Motor.MOTOR_A)); legoEV3BrickList.add(new LegoEv3PlayToneBrick(BrickValues.LEGO_FREQUENCY, BrickValues.LEGO_DURATION, BrickValues.LEGO_VOLUME)); legoEV3BrickList.add(new LegoEv3SetLedBrick(LegoEv3SetLedBrick.LedStatus.LED_GREEN)); return legoEV3BrickList; }</code><technical_language>this LEGO_SPEED now? If yes, please remove LEGO_POWER BrickValues</technical_language>

Target:
private List<Brick> setupLegoEv3CategoryList() { List<Brick> legoEV3BrickList = new ArrayList<Brick>(); legoEV3BrickList.add(new LegoEv3MotorTurnAngleBrick(LegoEv3MotorTurnAngleBrick.Motor.MOTOR_A, BrickValues.LEGO_ANGLE)); legoEV3BrickList.add(new LegoEv3MotorMoveBrick(LegoEv3MotorMoveBrick.Motor.MOTOR_A, BrickValues.LEGO_SPEED)); legoEV3BrickList.add(new LegoEv3MotorStopBrick(LegoEv3MotorStopBrick.Motor.MOTOR_A)); legoEV3BrickList.add(new LegoEv3PlayToneBrick(BrickValues.LEGO_FREQUENCY, BrickValues.LEGO_DURATION, BrickValues.LEGO_VOLUME)); legoEV3BrickList.add(new LegoEv3SetLedBrick(LegoEv3SetLedBrick.LedStatus.LED_GREEN)); return legoEV3BrickList; }
Source:
<code>public void initialize() { getDiskModel().initialize(); <START> getDiskModel().getSize().setIsChangeable(false); <END> imageInfoModel.getEntityChangedEvent().addListener((ev, sender, args) -> { getDiskModel().getSize().setIsChangeable(false); if (imageInfoModel.getContentType() == DiskContentType.ISO) { getDiskModel().getAlias().setEntity(imageInfoModel.getFileName()); getDiskModel().getDescription().setEntity(imageInfoModel.getFileName()); getDiskModel().getSize().setEntity(imageInfoModel.getActualSize()); } else { getDiskModel().getAlias().setEntity(null); getDiskModel().getDescription().setEntity(null); getDiskModel().getSize().setEntity( ((NewDiskModel) getDiskModel()).getMinimumDiskSize()); } }); }</code><technical_language>do need well? exist in master patch</technical_language>

Target:
public void initialize() { getDiskModel().initialize(); imageInfoModel.getEntityChangedEvent().addListener((ev, sender, args) -> { getDiskModel().getSize().setIsChangeable(false); if (imageInfoModel.getContentType() == DiskContentType.ISO) { getDiskModel().getAlias().setEntity(imageInfoModel.getFileName()); getDiskModel().getDescription().setEntity(imageInfoModel.getFileName()); getDiskModel().getSize().setEntity(imageInfoModel.getActualSize()); } else { getDiskModel().getAlias().setEntity(null); getDiskModel().getDescription().setEntity(null); getDiskModel().getSize().setEntity( ((NewDiskModel) getDiskModel()).getMinimumDiskSize()); } }); }
Source:
<code>public static void reset() { injectCalled = false; postConstructCalled = false; preDestroyCalled = false; <START> } <END></code><technical_language>I replaced produceCalled = false. modify pull request? Thanks for noticing</technical_language>

Target:
public static void reset() { injectCalled = false; postConstructCalled = false; preDestroyCalled = false; produceCalled = false; }
Source:
<code>public CompositeSearchKeywordResolver() { this.size = 0; <START> this.resolvers = new SearchKeywordResolver[2]; <END> }</code><technical_language>unnecessary microoptimization SearchKeywordResolver[2] instead of new ArrayList<>(2) pretty rest of code below. Is impact measured</technical_language>

Target:
public CompositeSearchKeywordResolver() { this.resolvers = new ArrayList<>(NUMBER_OF_DEFAULT_IMPLEMENTATIONS); }
Source:
<code>public List<Span> getChildren(String tenant, String id) { if (id == null) { throw new NullPointerException("Id should not be null!"); } Set<Span> children = childrenCache.get(id); <START> return children == null ? null : new ArrayList<>(children); <END> }</code><technical_language>issue trace cache - if a list for efficiency (iteration) cache a list converting set list time is accessed</technical_language>

Target:
public Set<Span> getChildren(String tenant, String id) { if (id == null) { throw new NullPointerException("Id should not be null!"); } Set<Span> children = childrenCache.get(id); return children == null ? null : Collections.unmodifiableSet(children); }
Source:
<code>public void pulse() { super.pulse(); if (ticksLived % 11 == 0) { <START> <END> if (location.getBlock().getRelative(getAttachedFace()).getType() == Material.AIR) { if (EventFactory.callEvent(new HangingBreakEvent(this, RemoveCause.PHYSICS)).isCancelled()) { return; } world.dropItemNaturally(location, new ItemStack(Material.PAINTING)); remove(); } } if (ticksLived % (20 * 5) == 0 && isObstructed()) { if (EventFactory.callEvent(new HangingBreakEvent(this, RemoveCause.PHYSICS)).isCancelled()) { return; } if (location.getBlock().getRelative(getAttachedFace()).getType() == Material.AIR) { world.dropItemNaturally(location, new ItemStack(Material.PAINTING)); remove(); } } }</code><technical_language>Whitespace</technical_language>

Target:
public void pulse() { super.pulse(); if (ticksLived % (20 * 5) == 0 && isObstructed()) { if (EventFactory.callEvent(new HangingBreakEvent(this, RemoveCause.PHYSICS)).isCancelled()) { return; } if (location.getBlock().getRelative(getAttachedFace()).getType() == Material.AIR) { world.dropItemNaturally(location, new ItemStack(Material.PAINTING)); remove(); } } }
Source:
<code>public ReplyHeader submitRequest(RequestHeader h, Record request, Record response, WatchRegistration watchRegistration, WatchDeregistration watchDeregistration) throws InterruptedException { ReplyHeader r = new ReplyHeader(); Packet packet = queuePacket(h, r, request, response, null, null, null, null, watchRegistration, watchDeregistration); synchronized (packet) { long waitStartTime = System.currentTimeMillis(); while (!packet.finished) { <START> packet.wait(requestTimeout); <END> if (!packet.finished && ((System.currentTimeMillis() - waitStartTime) >= requestTimeout)) { LOG.error("Time out error occurred for the packet '{}'.", packet); r.setErr(Code.TIMEOUT.intValue()); break; } } } if (r.getErr() == Code.TIMEOUT.intValue()) { sendThread.cleanAndNotifyState(); } return r; }</code><technical_language>This unconditionally adds a timeout is a pretty significant semantic change. wait indefinitely is a separate issue discuss later, a compatibility point of view provide a configuration option user opt in this feature this turned default. default is timeout client waits indefinitely, user wants opt in turn timeout needs explicit provide a sense them. Otherwise, solve problem of default timeout set in ZK config if this feature is turned default, problem is hard is default happy</technical_language>

Target:
public ReplyHeader submitRequest(RequestHeader h, Record request, Record response, WatchRegistration watchRegistration, WatchDeregistration watchDeregistration) throws InterruptedException { ReplyHeader r = new ReplyHeader(); Packet packet = queuePacket(h, r, request, response, null, null, null, null, watchRegistration, watchDeregistration); synchronized (packet) { if (requestTimeout > 0) { waitForPacketFinish(r, packet); } else { while (!packet.finished) { packet.wait(); } } } if (r.getErr() == Code.REQUESTTIMEOUT.intValue()) { sendThread.cleanAndNotifyState(); } return r; }
Source:
<code>public SortedMap<byte[], RowResult<byte[]>> getRows(TableReference tableRef, Iterable<byte[]> rows, ColumnSelection columnSelection) { if (Iterables.isEmpty(rows)) { <START> if (log.isTraceEnabled()) { <END> log.trace("Attempted getRows on '{}' table and with empty rows argument", tableRef, columnSelection, new Exception()); } else if (log.isDebugEnabled()) { log.debug("Attempted getRows on '{}' table and with empty rows argument", tableRef, columnSelection); } return AbstractTransaction.EMPTY_SORTED_ROWS; } if (columnSelection.allColumnsSelected()) { SortedMap<byte[], RowResult<byte[]>> loaded = super.getRows(tableRef, rows, columnSelection); cacheLoadedRows(tableRef, loaded.values()); return loaded; } else { Set<byte[]> toLoad = Sets.newHashSet(); ImmutableSortedMap.Builder<byte[], RowResult<byte[]>> inCache = ImmutableSortedMap.orderedBy(UnsignedBytes.lexicographicalComparator()); for (byte[] row : rows) { ImmutableSortedMap.Builder<byte[], byte[]> matches = ImmutableSortedMap.orderedBy(UnsignedBytes.lexicographicalComparator()); boolean nonEmpty = false; boolean shouldLoad = false; for (byte[] col : columnSelection.getSelectedColumns()) { byte[] val = getCachedCellIfPresent(tableRef, Cell.create(row, col)); if (val == null) { shouldLoad = true; break; } else if (val.length != 0) { matches.put(col, val); nonEmpty = true; } } if (shouldLoad) { toLoad.add(row); } else if (nonEmpty) { inCache.put(row, RowResult.create(row, matches.build())); } } SortedMap<byte[], RowResult<byte[]>> results = super.getRows(tableRef, toLoad, columnSelection); cacheLoadedRows(tableRef, results.values()); inCache.putAll(results); return inCache.build(); } }</code><technical_language>Do need explicit conditions here? familiar of logging libraries</technical_language>

Target:
public SortedMap<byte[], RowResult<byte[]>> getRows(TableReference tableRef, Iterable<byte[]> rows, ColumnSelection columnSelection) { if (Iterables.isEmpty(rows)) { return AbstractTransaction.EMPTY_SORTED_ROWS; } if (columnSelection.allColumnsSelected()) { SortedMap<byte[], RowResult<byte[]>> loaded = super.getRows(tableRef, rows, columnSelection); cacheLoadedRows(tableRef, loaded.values()); return loaded; } else { Set<byte[]> toLoad = Sets.newHashSet(); ImmutableSortedMap.Builder<byte[], RowResult<byte[]>> inCache = ImmutableSortedMap.orderedBy(UnsignedBytes.lexicographicalComparator()); for (byte[] row : rows) { ImmutableSortedMap.Builder<byte[], byte[]> matches = ImmutableSortedMap.orderedBy(UnsignedBytes.lexicographicalComparator()); boolean nonEmpty = false; boolean shouldLoad = false; for (byte[] col : columnSelection.getSelectedColumns()) { byte[] val = getCachedCellIfPresent(tableRef, Cell.create(row, col)); if (val == null) { shouldLoad = true; break; } else if (val.length != 0) { matches.put(col, val); nonEmpty = true; } } if (shouldLoad) { toLoad.add(row); } else if (nonEmpty) { inCache.put(row, RowResult.create(row, matches.build())); } } SortedMap<byte[], RowResult<byte[]>> results = super.getRows(tableRef, toLoad, columnSelection); cacheLoadedRows(tableRef, results.values()); inCache.putAll(results); return inCache.build(); } }
Source:
<code>public GlusterBrick update(GlusterBrick incomingBrick) { <START> validateParameters(incomingBrick, "id", "status"); <END> QueryIdResolver<Guid> brickResolver = new QueryIdResolver<Guid>(VdcQueryType.GetGlusterBrickById, IdQueryParameters.class); GlusterBrickEntity entity = getEntity(brickResolver, true); return performUpdate(incomingBrick, entity, map(entity), brickResolver, VdcActionType.UpdateGlusterVolumeBricks, new UpdateParametersProvider()); }</code><technical_language>need a reason for update - this populated in status.detail needs validated, reason for update needs logged in Audit log</technical_language>

Target:
public GlusterBrick update(GlusterBrick incomingBrick) { validateParameters(incomingBrick, "id", "status", "status.detail"); QueryIdResolver<Guid> brickResolver = new QueryIdResolver<Guid>(VdcQueryType.GetGlusterBrickById, IdQueryParameters.class); GlusterBrickEntity entity = getEntity(brickResolver, true); return performUpdate(incomingBrick, entity, map(entity), brickResolver, VdcActionType.UpdateGlusterVolumeBricks, new UpdateParametersProvider()); }
Source:
<code><START> public static Date getProcessValidityStart(Process process, String clusterName) throws FalconException { <END> Cluster feedCluster = getCluster(process, clusterName); if (feedCluster != null) { return feedCluster.getValidity().getStart(); } else { throw new FalconException("No matching cluster " + clusterName + "found for feed " + process.getName()); } }</code><technical_language>add methods for fine-grained elements.. getClusterValidity().getStart() do (of course, a null check)</technical_language>

Target:
public static Date getProcessValidityStart(Process process, String clusterName) throws FalconException { Cluster processCluster = getCluster(process, clusterName); if (processCluster != null) { return processCluster.getValidity().getStart(); } else { throw new FalconException("No matching cluster " + clusterName + "found for process " + process.getName()); } }
Source:
<code>public void checkinRoles(List<Role> roles) { EKBCommit commit = getEKBCommit(); preparePersistenceAccess(); for (Role role : roles) { <START> List<Role> result = queryService.queryByString(Role.class, "name:\"" + role.getName() + "\""); <END> if (result.size() == 0) { commit.addInsert(role); } else { commit.addUpdate(role); } } persistService.commit(commit); revokePersistenceAccess(); }</code><technical_language>query(QueryRequest) method</technical_language>

Target:
public void checkinRoles(List<Role> roles) { EKBCommit commit = getEKBCommit(); preparePersistenceAccess(); for (Role role : roles) { List<Role> result = queryService.query(Role.class, QueryRequest.query("name", role.getName())); if (result.size() == 0) { commit.addInsert(role); } else { commit.addUpdate(role); } } persistService.commit(commit); revokePersistenceAccess(); }
Source:
<code>public static boolean getScalabilityCapabilitiesOfModule(Map<String, Object> modules, String elementName) { try { Map<String, Object> moduleInfo; if (modules.containsKey(elementName)) { moduleInfo = (Map<String, Object>) modules.get(elementName); } else { <START> return true; <END> } Map<String, Object> moduleProperties; if (moduleInfo.containsKey(TOSCAkeywords.MODULE_PROPERTIES_TAG)) { moduleProperties = (Map<String, Object>) moduleInfo.get(TOSCAkeywords.MODULE_PROPERTIES_TAG); } else { return true; } if(moduleProperties.containsKey(TOSCAkeywords.MODULE_AUTOSCALE_PROPERTY)){ return (boolean) moduleProperties.get(TOSCAkeywords.MODULE_AUTOSCALE_PROPERTY); }else { return true; } } catch (ClassCastException e) { log.debug("For module it was not found information in the AAM regarding its possibility to scale", elementName); } return true; }</code><technical_language>a module scaling default. WDYT</technical_language>

Target:
public static boolean getScalabilityCapabilitiesOfModule(Map<String, Object> modules, String elementName) { try { Map<String, Object> moduleInfo; if (modules.containsKey(elementName)) { moduleInfo = (Map<String, Object>) modules.get(elementName); } else { return DEFAULT_SCALABILITY; } Map<String, Object> moduleProperties; if (moduleInfo.containsKey(TOSCAkeywords.MODULE_PROPERTIES_TAG)) { moduleProperties = (Map<String, Object>) moduleInfo.get(TOSCAkeywords.MODULE_PROPERTIES_TAG); } else { return DEFAULT_SCALABILITY; } if(moduleProperties.containsKey(TOSCAkeywords.MODULE_AUTOSCALE_PROPERTY)){ return (boolean) moduleProperties.get(TOSCAkeywords.MODULE_AUTOSCALE_PROPERTY); }else { return DEFAULT_SCALABILITY; } } catch (ClassCastException e) { log.debug("For module it was not found information in the AAM regarding its possibility to scale", elementName); } return DEFAULT_SCALABILITY; }
Source:
<code>protected void buildVmCD() { XmlRpcStruct struct; if (vm.getVmPayload() != null && vm.getVmPayload().getType() == VmDeviceType.CDROM) { VmDevice vmDevice = new VmDevice(new VmDeviceId(Guid.NewGuid(), vm.getId()), VmDeviceType.DISK.getName(), VmDeviceType.CDROM.getName(), "", 0, vm.getVmPayload().getSpecParams(), true, true, true); struct = new XmlRpcStruct(); addCdDetails(vmDevice, struct); addDevice(struct, vmDevice, ""); } else if (vm.isRunOnce() && !StringHelper.isNullOrEmpty(vm.getCdPath())) { VmDevice vmDevice = new VmDevice(new VmDeviceId(Guid.NewGuid(), vm.getId()), VmDeviceType.DISK.getName(), VmDeviceType.CDROM.getName(), "", 0, <START> vm.getVmPayload().getSpecParams(), <END> true, true, true); struct = new XmlRpcStruct(); addCdDetails(vmDevice, struct); addDevice(struct, vmDevice, vm.getCdPath()); } else { List<VmDevice> vmDevices = DbFacade.getInstance() .getVmDeviceDAO() .getVmDeviceByVmIdTypeAndDevice(vm.getId(), VmDeviceType.DISK.getName(), VmDeviceType.CDROM.getName()); for (VmDevice vmDevice : vmDevices) { if (!vmDevice.getIsManaged()) { continue; } if (!VmPayload.IsPayload(vmDevice.getSpecParams()) && vmDevices.size() > 1) { continue; } struct = new XmlRpcStruct(); String file = (String) vmDevice.getSpecParams().get(VdsProperties.Path); addCdDetails(vmDevice, struct); addAddress(vmDevice, struct); if (!StringHelper.isNullOrEmpty(file)) { addCdOrFloppyFileDetails(file, struct); } else { file = ""; } addDevice(struct, vmDevice, file); break; } } }</code><technical_language>this is a potential NullPointerException checked previously vm.getVmPayload() null if reached here</technical_language>

Target:
protected void buildVmCD() { XmlRpcStruct struct; if (vm.getVmPayload() != null && vm.getVmPayload().getType() == VmDeviceType.CDROM) { VmDevice vmDevice = new VmDevice(new VmDeviceId(Guid.NewGuid(), vm.getId()), VmDeviceType.DISK.getName(), VmDeviceType.CDROM.getName(), "", 0, vm.getVmPayload().getSpecParams(), true, true, true); struct = new XmlRpcStruct(); addCdDetails(vmDevice, struct); addDevice(struct, vmDevice, ""); } else if (vm.isRunOnce() && !StringHelper.isNullOrEmpty(vm.getCdPath())) { VmDevice vmDevice = new VmDevice(new VmDeviceId(Guid.NewGuid(), vm.getId()), VmDeviceType.DISK.getName(), VmDeviceType.CDROM.getName(), "", 0, (vm.getVmPayload() == null) ? null : vm.getVmPayload().getSpecParams(), true, true, true); struct = new XmlRpcStruct(); addCdDetails(vmDevice, struct); addDevice(struct, vmDevice, vm.getCdPath()); } else { List<VmDevice> vmDevices = DbFacade.getInstance() .getVmDeviceDAO() .getVmDeviceByVmIdTypeAndDevice(vm.getId(), VmDeviceType.DISK.getName(), VmDeviceType.CDROM.getName()); for (VmDevice vmDevice : vmDevices) { if (!vmDevice.getIsManaged()) { continue; } if (!VmPayload.isPayload(vmDevice.getSpecParams()) && vmDevices.size() > 1) { continue; } struct = new XmlRpcStruct(); String file = (String) vmDevice.getSpecParams().get(VdsProperties.Path); addCdDetails(vmDevice, struct); addAddress(vmDevice, struct); if (!StringHelper.isNullOrEmpty(file)) { addCdOrFloppyFileDetails(file, struct); } else { file = ""; } addDevice(struct, vmDevice, file); break; } } }
Source:
<code>private Activity getCurrentActivity() { <START> final Activity[] activity = new Activity[1]; <END> java.util.Collection<Activity> activities = ActivityLifecycleMonitorRegistry.getInstance().getActivitiesInStage(Stage.RESUMED); activity[0] = Iterables.getOnlyElement(activities); return activity[0]; }</code><technical_language>is array necessary here? is item</technical_language>

Target:
private Activity getCurrentActivity() { Activity activity; java.util.Collection<Activity> activities = ActivityLifecycleMonitorRegistry.getInstance().getActivitiesInStage(Stage.RESUMED); activity = Iterables.getOnlyElement(activities); return activity; }
Source:
<code>private void breakBlock(BlockMenu menu, Collection<ItemStack> drops, Block block) { <START> for (ItemStack drop : drops) { <END> menu.pushItem(drop, getOutputSlots()); } InfiniteBlockGenerator generator = InfiniteBlockGenerator.findAt(block, firesEvent.getValue()); if (generator != null) { block.getWorld().playSound(block.getLocation(), Sound.BLOCK_FIRE_EXTINGUISH, 0.075F, 0.8F); block.getWorld().spawnParticle(Particle.SMOKE_NORMAL, block.getX() + 0.5, block.getY() + 1.25, block.getZ() + 0.5, 8, 0.5, 0.5, 0.5, 0.015); } else { block.setType(Material.AIR); } }</code><technical_language>checking if drops fit anymore? code a if (menu.fits(drop, getOutputSlots())) check, I skip</technical_language>

Target:
private void breakBlock(BlockMenu menu, Collection<ItemStack> drops, Block block) { for (ItemStack drop : drops) { menu.pushItem(drop, getOutputSlots()); } InfiniteBlockGenerator generator = InfiniteBlockGenerator.findAt(block); if (generator != null) { if (firesEvent.getValue()) { generator.callEvent(block); } block.getWorld().playSound(block.getLocation(), Sound.BLOCK_FIRE_EXTINGUISH, 0.075F, 0.8F); block.getWorld().spawnParticle(Particle.SMOKE_NORMAL, block.getX() + 0.5, block.getY() + 1.25, block.getZ() + 0.5, 8, 0.5, 0.5, 0.5, 0.015); } else { block.setType(Material.AIR); } }
Source:
<code>private CompletionStage<RestResponse> getCaches(RestRequest request) { NettyRestResponse.Builder responseBuilder = checkCacheManager(request); if (responseBuilder.getHttpStatus() == NOT_FOUND) return completedFuture(responseBuilder.build()); <START> class CacheInfo { <END> public String status; public String name; public String type; public long size; public boolean simpleCache; public boolean transactional; public boolean persistent; } try { Set<CacheInfo> caches = cacheManager.getCacheNames().stream().map(cacheName -> { Cache<Object, Object> cache = cacheManager.getCache(cacheName); CacheInfo cacheInfo = new CacheInfo(); cacheInfo.name = cacheName; cacheInfo.type = cache.getCacheConfiguration().clustering().cacheMode().toCacheType(); cacheInfo.status = cache.getStatus().name(); cacheInfo.size = cache.size(); cacheInfo.simpleCache = cache.getCacheConfiguration().simpleCache(); cacheInfo.transactional = cache.getCacheConfiguration().transaction().transactionMode().isTransactional(); cacheInfo.persistent = false; return cacheInfo; }).collect(Collectors.toSet()); byte[] bytes = objectMapper.writeValueAsBytes(caches); responseBuilder.contentType(APPLICATION_JSON).entity(bytes); } catch (JsonProcessingException e) { responseBuilder.status(HttpResponseStatus.INTERNAL_SERVER_ERROR); } return completedFuture(responseBuilder.build()); }</code><technical_language>IMHO this class declared method private static</technical_language>

Target:
private CompletionStage<RestResponse> getCaches(RestRequest request) { NettyRestResponse.Builder responseBuilder = checkCacheManager(request); if (responseBuilder.getHttpStatus() == NOT_FOUND) return completedFuture(responseBuilder.build()); return CompletableFuture.supplyAsync(() -> { try { Set<CacheInfo> caches = cacheManager.getCacheNames().stream().map(cacheName -> { Cache<Object, Object> cache = cacheManager.getCache(cacheName); CacheInfo cacheInfo = new CacheInfo(); cacheInfo.name = cacheName; Configuration cacheConfiguration = cache.getCacheConfiguration(); cacheInfo.type = cacheConfiguration.clustering().cacheMode().toCacheType(); cacheInfo.status = cache.getStatus().name(); cacheInfo.size = cache.size(); cacheInfo.simpleCache = cacheConfiguration.simpleCache(); cacheInfo.transactional = cacheConfiguration.transaction().transactionMode().isTransactional(); cacheInfo.persistent = cacheConfiguration.persistence().usingStores(); cacheInfo.bounded = cacheConfiguration.expiration().maxIdle() != -1 || cacheConfiguration.expiration().lifespan() != -1 ; cacheInfo.secured = cacheConfiguration.security().authorization().enabled(); cacheInfo.indexed = cacheConfiguration.indexing().index().isEnabled(); cacheInfo.hasRemoteBackup = cacheConfiguration.sites().hasEnabledBackups(); return cacheInfo; }).collect(Collectors.toSet()); byte[] bytes = objectMapper.writeValueAsBytes(caches); responseBuilder.contentType(APPLICATION_JSON).entity(bytes); } catch (JsonProcessingException e) { responseBuilder.status(HttpResponseStatus.INTERNAL_SERVER_ERROR); } return responseBuilder.build(); }, executor); }
Source:
<code>private void writeOs() { writer.writeStartElement("os"); writer.writeStartElement("type"); writer.writeAttributeString("arch", vm.getClusterArch().toString()); writer.writeAttributeString("machine", emulatedMachine); writer.writeRaw("hvm"); writer.writeEndElement(); if (!StringUtils.isEmpty(vm.getInitrdUrl())) { writer.writeElement("initrd", vm.getInitrdUrl()); } if (!StringUtils.isEmpty(vm.getKernelUrl())) { writer.writeElement("kernel", vm.getKernelUrl()); if (!StringUtils.isEmpty(vm.getKernelParams())) { writer.writeElement("cmdline", vm.getKernelParams()); } } if (vm.getClusterArch().getFamily() == ArchitectureType.x86) { writer.writeStartElement("smbios"); writer.writeAttributeString("mode", "sysinfo"); writer.writeEndElement(); } if (vm.isBootMenuEnabled()) { writer.writeStartElement("bootmenu"); writer.writeAttributeString("enable", "yes"); writer.writeAttributeString("timeout", String.valueOf(BOOT_MENU_TIMEOUT)); writer.writeEndElement(); } if (serialConsolePath != null && vm.getClusterArch().getFamily() == ArchitectureType.x86) { writer.writeStartElement("bios"); writer.writeAttributeString("useserial", "yes"); writer.writeEndElement(); } if (vm.getBiosType().isOvmf()) { writer.writeStartElement("loader"); writer.writeAttributeString("readonly", "yes"); writer.writeAttributeString("secure", vm.getBiosType() == BiosType.Q35_SECURE_BOOT ? "yes" : "no"); writer.writeAttributeString("type", "pflash"); writer.writeRaw("/usr/share/OVMF/OVMF_CODE.secboot.fd"); writer.writeEndElement(); writer.writeStartElement("nvram"); <START> writer.writeAttributeString("template", "/usr/share/OVMF/OVMF_VARS.fd"); <END> writer.writeRaw(String.format("/var/lib/libvirt/qemu/nvram/%s.fd", vm.getId())); writer.writeEndElement(); } writer.writeEndElement(); }</code><technical_language>default is set libvirt</technical_language>

Target:
private void writeOs() { writer.writeStartElement("os"); writer.writeStartElement("type"); writer.writeAttributeString("arch", vm.getClusterArch().toString()); writer.writeAttributeString("machine", emulatedMachine); writer.writeRaw("hvm"); writer.writeEndElement(); if (!StringUtils.isEmpty(vm.getInitrdUrl())) { writer.writeElement("initrd", vm.getInitrdUrl()); } if (!StringUtils.isEmpty(vm.getKernelUrl())) { writer.writeElement("kernel", vm.getKernelUrl()); if (!StringUtils.isEmpty(vm.getKernelParams())) { writer.writeElement("cmdline", vm.getKernelParams()); } } if (vm.getClusterArch().getFamily() == ArchitectureType.x86) { writer.writeStartElement("smbios"); writer.writeAttributeString("mode", "sysinfo"); writer.writeEndElement(); } if (vm.isBootMenuEnabled()) { writer.writeStartElement("bootmenu"); writer.writeAttributeString("enable", "yes"); writer.writeAttributeString("timeout", String.valueOf(BOOT_MENU_TIMEOUT)); writer.writeEndElement(); } if (serialConsolePath != null && vm.getClusterArch().getFamily() == ArchitectureType.x86) { writer.writeStartElement("bios"); writer.writeAttributeString("useserial", "yes"); writer.writeEndElement(); } writer.writeEndElement(); }
Source:
<code>public Result execute(UIExecutionContext context) throws Exception { JavaResource javaResource = targetClass.getValue(); JavaClassSource targetClass = javaResource.getJavaType(); List<FieldSource<JavaClassSource>> selectedFields = new ArrayList<>(); for(String fieldString : fields.getValue()) { selectedFields.add(targetClass.getField(fieldString)); } <START> Refactory.createHashCodeAndEquals(targetClass, selectedFields.toArray(new FieldSource<?>[selectedFields.size()])); <END> setCurrentWorkingResource(context, targetClass); return Results.success("Methods were generated succesfully"); }</code><technical_language>I prompt user choose if want existing methods overwritten. UIPrompt mind for this case. @gastaldi do think</technical_language>

Target:
public Result execute(UIExecutionContext context) throws Exception { JavaResource javaResource = targetClass.getValue(); JavaClassSource targetClass = javaResource.getJavaType(); List<FieldSource<JavaClassSource>> selectedFields = new ArrayList<>(); for(String fieldString : fields.getValue()) { selectedFields.add(targetClass.getField(fieldString)); } UIPrompt prompt = context.getPrompt(); if(targetClass.hasMethodSignature("equals", Object.class)) { if(prompt.promptBoolean("Class already has an equals method. Would you like it to be overwritten?")) { Refactory.createEquals(targetClass, selectedFields.toArray(new FieldSource<?>[selectedFields.size()])); } } else { Refactory.createEquals(targetClass, selectedFields.toArray(new FieldSource<?>[selectedFields.size()])); } if(targetClass.hasMethodSignature("hashcode")) { if(prompt.promptBoolean("Class already has a hashcode method. Would you like it to be overwritten?")) { Refactory.createHashCode(targetClass, selectedFields.toArray(new FieldSource<?>[selectedFields.size()])); } } else { Refactory.createHashCode(targetClass, selectedFields.toArray(new FieldSource<?>[selectedFields.size()])); } setCurrentWorkingResource(context, targetClass); return Results.success("Command for generation ended successfully"); }
Source:
<code>private static void addAllCus(HashSet<ICompilationUnit> collector, IJavaElement javaElement) throws JavaModelException { switch (javaElement.getElementType()) { case IJavaElement.JAVA_PROJECT: IJavaProject javaProject= (IJavaProject) javaElement; IPackageFragmentRoot[] packageFragmentRoots= javaProject.getPackageFragmentRoots(); for (IPackageFragmentRoot <START> packageFragmentRoot2 : <END> packageFragmentRoots) addAllCus(collector, packageFragmentRoot2); return; case IJavaElement.PACKAGE_FRAGMENT_ROOT: IPackageFragmentRoot packageFragmentRoot= (IPackageFragmentRoot) javaElement; if (packageFragmentRoot.getKind() != IPackageFragmentRoot.K_SOURCE) return; IJavaElement[] packageFragments= packageFragmentRoot.getChildren(); for (IJavaElement packageFragment2 : packageFragments) addAllCus(collector, packageFragment2); return; case IJavaElement.PACKAGE_FRAGMENT: IPackageFragment packageFragment= (IPackageFragment) javaElement; collector.addAll(Arrays.asList(packageFragment.getCompilationUnits())); return; case IJavaElement.COMPILATION_UNIT: collector.add((ICompilationUnit) javaElement); return; default: IJavaElement cu= javaElement.getAncestor(IJavaElement.COMPILATION_UNIT); if (cu != null) collector.add((ICompilationUnit) cu); } }</code><technical_language>packageFragmentRoot2? Suggest naming this "root"</technical_language>

Target:
private static void addAllCus(HashSet<ICompilationUnit> collector, IJavaElement javaElement) throws JavaModelException { switch (javaElement.getElementType()) { case IJavaElement.JAVA_PROJECT: IJavaProject javaProject= (IJavaProject) javaElement; IPackageFragmentRoot[] packageFragmentRoots= javaProject.getPackageFragmentRoots(); for (int i= 0; i < packageFragmentRoots.length; i++) addAllCus(collector, packageFragmentRoots[i]); return; case IJavaElement.PACKAGE_FRAGMENT_ROOT: IPackageFragmentRoot packageFragmentRoot= (IPackageFragmentRoot) javaElement; if (packageFragmentRoot.getKind() != IPackageFragmentRoot.K_SOURCE) return; IJavaElement[] packageFragments= packageFragmentRoot.getChildren(); for (int j= 0; j < packageFragments.length; j++) addAllCus(collector, packageFragments[j]); return; case IJavaElement.PACKAGE_FRAGMENT: IPackageFragment packageFragment= (IPackageFragment) javaElement; collector.addAll(Arrays.asList(packageFragment.getCompilationUnits())); return; case IJavaElement.COMPILATION_UNIT: collector.add((ICompilationUnit) javaElement); return; default: IJavaElement cu= javaElement.getAncestor(IJavaElement.COMPILATION_UNIT); if (cu != null) collector.add((ICompilationUnit) cu); } }
Source:
<code>protected Map<String, Object> postProcessSourceProperties(String sourceName, Map<String, Object> properties) { if(PatternMatchUtils.simpleMatch(sourceNamePatterns, sourceName)) { <START> properties.replaceAll((key, value) -> "******"); <END> } return super.postProcessSourceProperties(sourceName, properties); }</code><technical_language>This code masks _values_ in property source _keys_. keys safe expose</technical_language>

Target:
protected Map<String, Object> postProcessSourceProperties(String sourceName, Map<String, Object> properties) { if(PatternMatchUtils.simpleMatch(sourceNamePatterns, sourceName)) { return Collections.singletonMap("******", message); } return super.postProcessSourceProperties(sourceName, properties); }
Source:
<code>public abstract E parseFromInput(String input, ParserContext context) throws InputParseException; public List<String> getSuggestions() { <START> return Lists.newArrayList(); <END> }</code><technical_language>I prefer a of Collections.emptyList() here, need for this array list</technical_language>

Target:
public abstract E parseFromInput(String input, ParserContext context) throws InputParseException; public List<String> getSuggestions() { return Collections.emptyList(); }
Source:
<code>private void trackAATestCourseOutline() { if (!isVideoMode && environment.getConfig().getFirebaseConfig().isEnabled()) { <START> FirebaseRemoteConfig firebaseRemoteConfig = FirebaseRemoteConfig.getInstance(); <END> firebaseRemoteConfig.fetchAndActivate().addOnCompleteListener(task -> { String group = firebaseRemoteConfig.getString(Analytics.Keys.AA_EXPERIMENT); if (!TextUtils.isEmpty(group)) { final Map<String, String> values = new HashMap<>(); values.put(Analytics.Keys.EXPERIMENT, Analytics.Keys.AA_EXPERIMENT); values.put(Analytics.Keys.GROUP, group); values.put(Analytics.Keys.USER_ID, environment.getLoginPrefs().getCurrentUserProfile().id.toString()); values.put(Analytics.Keys.COURSE_ID, courseData.getCourse().getId()); environment.getAnalyticsRegistry().trackRemoteConfigs(values); } }); } }</code><technical_language>final</technical_language>

Target:
private void trackAATestCourseOutline() { if (!isVideoMode && environment.getConfig().getFirebaseConfig().isEnabled()) { final FirebaseRemoteConfig firebaseRemoteConfig = FirebaseRemoteConfig.getInstance(); firebaseRemoteConfig.fetchAndActivate().addOnCompleteListener(task -> { final String group = firebaseRemoteConfig.getString(Analytics.Keys.AA_EXPERIMENT); if (!TextUtils.isEmpty(group)) { final Map<String, String> values = new HashMap<>(); values.put(Analytics.Keys.EXPERIMENT, Analytics.Keys.AA_EXPERIMENT); values.put(Analytics.Keys.GROUP, group); values.put(Analytics.Keys.USER_ID, environment.getLoginPrefs().getCurrentUserProfile().id.toString()); values.put(Analytics.Keys.COURSE_ID, courseData.getCourse().getId()); environment.getAnalyticsRegistry().trackExperimentParams(Analytics.Events.MOBILE_EXPERIMENT_EVALUATED, values); } }); } }
Source:
<code>public boolean onShutdown(long timeout, TimeUnit unit) { if (nodeEngine.getLocalMember().isLiteMember()) { return true; } long timeoutNanos = unit.toNanos(timeout); for (CRDTReplicationAwareService service : getReplicationServices()) { service.prepareToSafeShutdown(); final CRDTReplicationContainer replicationOperation = service.prepareReplicationOperation( replicationVectorClocks.getLatestReplicatedVectorClock(service.getName()), 0); if (replicationOperation == null) { logger.fine("Skipping replication since all CRDTs are replicated"); continue; } long startNanos = Timer.nanos(); if (!tryProcessOnOtherMembers(replicationOperation.getOperation(), service.getName(), timeoutNanos)) { logger.warning("Failed replication of CRDTs for " + service.getName() + ". CRDT state may be lost."); } <START> timeoutNanos -= Timer.nanosElapsed(startNanos); <END> if (timeoutNanos < 0) { return false; } } return true; }</code><technical_language>I pull this timeout logic a seperate PR. if Timer is abstraction for it</technical_language>

Target:
public boolean onShutdown(long timeout, TimeUnit unit) { if (nodeEngine.getLocalMember().isLiteMember()) { return true; } long timeoutNanos = unit.toNanos(timeout); for (CRDTReplicationAwareService service : getReplicationServices()) { service.prepareToSafeShutdown(); final CRDTReplicationContainer replicationOperation = service.prepareReplicationOperation( replicationVectorClocks.getLatestReplicatedVectorClock(service.getName()), 0); if (replicationOperation == null) { logger.fine("Skipping replication since all CRDTs are replicated"); continue; } long start = System.nanoTime(); if (!tryProcessOnOtherMembers(replicationOperation.getOperation(), service.getName(), timeoutNanos)) { logger.warning("Failed replication of CRDTs for " + service.getName() + ". CRDT state may be lost."); } timeoutNanos -= (System.nanoTime() - start); if (timeoutNanos < 0) { return false; } } return true; }
Source:
<code>public GeoserveRegionsService(final String endpointUrl, final int connectTimeout, final int readTimeout) { <START> this.endpointUrl = endpointUrl; <END> this.connectTimeout = connectTimeout; this.readTimeout = readTimeout; }</code><technical_language>call setter functions here</technical_language>

Target:
public GeoserveRegionsService(final String endpointUrl, final int connectTimeout, final int readTimeout) { this.setEndpointURL(endpointUrl); this.setConnectTimeout(connectTimeout); this.setReadTimeout(readTimeout); }
Source:
<code>public IfTttDaemon(final AlarmDao alarmDao, final TransactionOperations transactionOperations) { <START> this.m_alarmDao = alarmDao; <END> this.m_transactionOperations = transactionOperations; this.m_fileReloadContainer = new FileReloadContainer<>(ifTttConfigFile, (object, resource) -> { LOG.debug("Reloading configuration file {}.", resource.getFilename()); return JaxbUtils.unmarshal(IfTttConfig.class, ifTttConfigFile); }); }</code><technical_language>Nit: this. is superfluous m_ prefix</technical_language>

Target:
public IfTttDaemon(final AlarmDao alarmDao, final TransactionOperations transactionOperations) { this(alarmDao, transactionOperations, Paths.get(System.getProperty("opennms.home", ""), "etc", "ifttt-config.xml").toFile()); }
Source:
<code>private void doUsfmImportUri(Uri uri) { String path = uri.toString(); String ext = FilenameUtils.getExtension(path).toLowerCase(); <START> boolean tstudio = ext.equalsIgnoreCase(Translator.ARCHIVE_EXTENSION); <END> if (tstudio) { importUri(uri); } else { ImportUsfmActivity.startActivityForUriImport(getActivity(), uri); } }</code><technical_language>I fallback importing archive. If chose import usfm allow usfm. Simpler is better. confirm file extension is .usfm</technical_language>

Target:
private void doUsfmImportUri(Uri uri) { String path = uri.toString(); String ext = FilenameUtils.getExtension(path).toLowerCase(); ImportUsfmActivity.startActivityForUriImport(getActivity(), uri); }
Source:
<code>boolean isPushingSection( OSMWay way ) { String highway = way.getTag("highway"); String trackType = way.getTag("tracktype"); return way.hasTag("highway", pushingSections) || way.hasTag("railway", "platform") <START> || way.hasTag("bicycle", "dismount") <END> || "track".equals(highway) && trackType != null && !"grade1".equals(trackType); }</code><technical_language>isPushingSection instead (?)</technical_language>

Target:
boolean isPushingSection( OSMWay way ) { String highway = way.getTag("highway"); String trackType = way.getTag("tracktype"); return super.isPushingSection(way) || "track".equals(highway) && trackType != null && !"grade1".equals(trackType); }
Source:
<code>public boolean equals(Object obj) { if (this == obj) { return true; } <START> if (obj == null) { <END> return false; } if (getClass() != obj.getClass()) { return false; } ModuleMetadata other = (ModuleMetadata) obj; return Objects.equals(id, other.id) && Objects.equals(version, other.version) && Objects.equals(displayName, other.displayName) && Objects.equals(description, other.description) && Objects.equals(requiredPermissions, other.requiredPermissions) && Objects.equals(dependencies, other.dependencies) && Objects.equals(extensions, other.extensions); }</code><technical_language>need for a null check here, instanceof allow class null check one</technical_language>

Target:
public boolean equals(Object obj) { if (this == obj) { return true; } if (obj instanceof ModuleMetadata) { ModuleMetadata other = (ModuleMetadata) obj; return Objects.equals(id, other.id) && Objects.equals(version, other.version) && Objects.equals(displayName, other.displayName) && Objects.equals(description, other.description) && Objects.equals(requiredPermissions, other.requiredPermissions) && Objects.equals(dependencies, other.dependencies) && Objects.equals(extensions, other.extensions); } return false; }