auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public static String getDiscriminator(String propertyName, String propertyKey, String visibilityString, long timestamp) { <START> String discriminatorWithoutTimestamp = getDiscriminatorWithoutTimestamp(propertyName, propertyKey, visibilityString); <END> String timestampString = Long.toHexString(timestamp); int length = discriminatorWithoutTimestamp.length() + 1 + timestampString.length(); return new StringBuilder(length) .append(discriminatorWithoutTimestamp) .append(VALUE_SEPARATOR) .append(timestampString) .toString(); }</code><technical_language>duplicate logic getDiscriminatorWithoutTimestamp (ie leave getDiscriminator was). getDiscriminator is called a lot performance squeeze out better</technical_language>

Target:
public static String getDiscriminator(String propertyName, String propertyKey, String visibilityString, long timestamp) { assertNoValueSeparator(propertyName); assertNoValueSeparator(propertyKey); assertNoValueSeparator(visibilityString); String timestampString = Long.toHexString(timestamp); int length = propertyName.length() + 1 + propertyKey.length() + 1 + visibilityString.length() + 1 + timestampString.length(); return new StringBuilder(length) .append(propertyName) .append(VALUE_SEPARATOR) .append(propertyKey) .append(VALUE_SEPARATOR) .append(visibilityString) .append(VALUE_SEPARATOR) .append(timestampString) .toString(); }
Source:
<code>public int available() throws IOException { <START> return (int) Math.min(this.origin.available(), this.more); <END> }</code><technical_language>@rui-castro if this sense me, this changes initial logic of this method, I architect decide</technical_language>

Target:
public int available() throws IOException { return (int) Math.min((long) this.origin.available(), this.more); }
Source:
<code>public void testJsonDocumentWithMaxLevelAndNumberOfNodes() throws IOException { JsonTestHelper.createTestDocument(); final var database = JsonTestHelper.getDatabase(PATHS.PATH1.getFile()); try (final var manager = database.openResourceManager(JsonTestHelper.RESOURCE)) { <START> try (final Writer writer = new StringWriter()) { final var serializer = new JsonSerializer.Builder(manager, writer).maxLevel(2).numberOfNodes(3).build(); serializer.call(); final var expected = "{\"foo\":[]}"; assertEquals(expected, writer.toString()); } try (final Writer writer = new StringWriter()) { final var serializer = new JsonSerializer.Builder(manager, writer).maxLevel(2).numberOfNodes(4).build(); serializer.call(); final var expected = "{\"foo\":[]}"; assertEquals(expected, writer.toString()); } try (final Writer writer = new StringWriter()) { final var serializer = new JsonSerializer.Builder(manager, writer).maxLevel(2).numberOfNodes(5).build(); serializer.call(); final var expected = "{\"foo\":[],\"bar\":{}}"; assertEquals(expected, writer.toString()); } try (final Writer writer = new StringWriter()) { final var serializer = new JsonSerializer.Builder(manager, writer).maxLevel(2).numberOfNodes(6).build(); <END> serializer.call(); final var expected = "{\"foo\":[],\"bar\":{}}"; assertEquals(expected, writer.toString()); } } }</code><technical_language>This redundant, clean if write another method private String getSerializedString(int maxLevel, int numberOfNodes)</technical_language>

Target:
public void testJsonDocumentWithMaxLevelAndNumberOfNodes() throws IOException { JsonTestHelper.createTestDocument(); final var database = JsonTestHelper.getDatabase(PATHS.PATH1.getFile()); try (final var manager = database.openResourceManager(JsonTestHelper.RESOURCE)) { var serializedString = getSerializedStringWithMaxLevelAndNumberOfNodes(manager, 2, 3); var expected = "{\"foo\":[]}"; assertEquals(expected, serializedString); serializedString = getSerializedStringWithMaxLevelAndNumberOfNodes(manager, 2, 4); assertEquals(expected, serializedString); serializedString = getSerializedStringWithMaxLevelAndNumberOfNodes(manager, 2, 5); expected = "{\"foo\":[],\"bar\":{}}"; assertEquals(expected, serializedString); serializedString = getSerializedStringWithMaxLevelAndNumberOfNodes(manager, 2, 6); assertEquals(expected, serializedString); } }
Source:
<code>public void testRegisterCheckOutEvict() throws Exception { Service service = mock(Service.class); when(_factory.create(any(ServiceEndPoint.class))).thenReturn(service); MultiThreadedClientServiceCache<Service> cache = newCache(0); cache.register(_endPoint); <START> assertSame(1, cache.getNumActiveInstances(_endPoint)); <END> assertSame(1, cache.getNumIdleInstances(_endPoint)); ServiceHandle<Service> handle = cache.checkOut(_endPoint); assertSame(handle.getService(), service); assertSame(1, cache.getNumActiveInstances(_endPoint)); assertSame(1, cache.getNumIdleInstances(_endPoint)); cache.evict(_endPoint); verify(_factory, timeout(100).times(1)).destroy(_endPoint, handle.getService()); assertSame(0, cache.getNumActiveInstances(_endPoint)); assertSame(0, cache.getNumIdleInstances(_endPoint)); }</code><technical_language>numbers assertEquals</technical_language>

Target:
public void testRegisterCheckOutEvict() throws Exception { Service service = mock(Service.class); when(_factory.create(any(ServiceEndPoint.class))).thenReturn(service); MultiThreadedClientServiceCache<Service> cache = newCache(0); cache.register(_endPoint); assertEquals(1, cache.getNumActiveInstances(_endPoint)); assertEquals(1, cache.getNumIdleInstances(_endPoint)); ServiceHandle<Service> handle = cache.checkOut(_endPoint); assertSame(service, handle.getService()); assertEquals(1, cache.getNumActiveInstances(_endPoint)); assertEquals(1, cache.getNumIdleInstances(_endPoint)); cache.evict(_endPoint); verify(_factory, timeout(100).times(1)).destroy(_endPoint, handle.getService()); assertEquals(0, cache.getNumActiveInstances(_endPoint)); assertEquals(0, cache.getNumIdleInstances(_endPoint)); }
Source:
<code>private void addCommonCourtsToModel(JudgmentCriteriaForm judgmentCriteriaForm, ModelMap model) { <START> if(judgmentCriteriaForm.getCourtType() != null && CourtType.COMMON.equals(judgmentCriteriaForm.getCourtType())) { <END> model.addAttribute("commonCourts", ccListService.findCommonCourts()); if (judgmentCriteriaForm.getCommonCourtId() != null) { model.addAttribute("commonCourtDivisions", ccListService.findCcDivisions(judgmentCriteriaForm.getCommonCourtId())); } } }</code><technical_language>is need for null checking in this case - condition is enough</technical_language>

Target:
private void addCommonCourtsToModel(JudgmentCriteriaForm judgmentCriteriaForm, ModelMap model) { if(CourtType.COMMON.equals(judgmentCriteriaForm.getCourtType())) { model.addAttribute("commonCourts", ccListService.findCommonCourts()); if (judgmentCriteriaForm.getCommonCourtId() != null) { model.addAttribute("commonCourtDivisions", ccListService.findCcDivisions(judgmentCriteriaForm.getCommonCourtId())); } } }
Source:
<code>public void openMarketplace(final String origin) { SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(mContext); <START> String email = prefs.getString("userEmail", "unknown@email.com"); <END> if(!email.equals("unknown@email.com")) { email = "?email=" + email; } else { email = ""; } final String url = "<LINK_0>" + email; AlertDialog alertDialog = new AlertDialog.Builder(mContext).create(); alertDialog.setTitle(mContext.getString(R.string.opening_manager)); alertDialog.setMessage(mContext.getString(R.string.opening_manager_description)); alertDialog.setButton(AlertDialog.BUTTON_POSITIVE, "OK", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int which) { JSONObject props = MixPanel.buildProp("origin", origin); mMixpanel.track("Open marketplace", props); Intent i = new Intent(Intent.ACTION_VIEW); i.setData(Uri.parse(url)); mContext.startActivity(i); } }); alertDialog.show(); }</code><technical_language>return "" default</technical_language>

Target:
public void openMarketplace(final String origin) { SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(mContext); String email = prefs.getString("userEmail", ""); email = !email.isEmpty() ? "?email=" + email : ""; final String url = "<LINK_0>" + email; AlertDialog alertDialog = new AlertDialog.Builder(mContext).create(); alertDialog.setTitle(mContext.getString(R.string.opening_manager)); alertDialog.setMessage(mContext.getString(R.string.opening_manager_description)); alertDialog.setButton(AlertDialog.BUTTON_POSITIVE, "OK", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int which) { JSONObject props = MixPanel.buildProp("origin", origin); mMixpanel.track("Open marketplace", props); Intent i = new Intent(Intent.ACTION_VIEW); i.setData(Uri.parse(url)); mContext.startActivity(i); } }); alertDialog.show(); }
Source:
<code>private boolean canUpdateEntity(World _this, int startBlockX, int oldStartBlockY, int startBlockZ, int endBlockX, int oldEndBlockY, int endBlockZ, boolean allowEmpty) { if (!this.isCubicWorld()) { return isAreaLoaded(startBlockX, oldStartBlockY, startBlockZ, endBlockX, oldEndBlockY, endBlockZ, allowEmpty); } return this.isRemote() || this.getCubeFromBlockCoords( new BlockPos(updateEntity_entityPosX, updateEntity_entityPosY, updateEntity_entityPosZ)) <START> .getTickets().shouldTick(); <END> }</code><technical_language>This is broken readable now. loads cubes. load cubes. First: tick entities of world border - fall out of world stuck forever. - leave 32 block thing. Entities access nearby blocks, a lot of ender dragon. need some buffer radius</technical_language>

Target:
private boolean canUpdateEntity(World _this, int startBlockX, int oldStartBlockY, int startBlockZ, int endBlockX, int oldEndBlockY, int endBlockZ, boolean allowEmpty) { if (!this.isCubicWorld()) { return isAreaLoaded(startBlockX, oldStartBlockY, startBlockZ, endBlockX, oldEndBlockY, endBlockZ, allowEmpty); } BlockPos entityPos = new BlockPos(updateEntity_entityPosX, updateEntity_entityPosY, updateEntity_entityPosZ); return this.isRemote() || !this.isValid(entityPos) || this.getCubeFromBlockCoords(entityPos).getTickets().shouldTick(); }
Source:
<code>private void assertTransformationsGenerated(SimpleTransformApplication simpleTransformApplication) throws IOException { ObjectMapper mapper = new ObjectMapper(); POJOGenerator pojoGenerator = simpleTransformApplication.getPojoDataGenerator(); int maxLengthOfCustomerName = 1 + ( 2 * pojoGenerator.getMaxNameLength()); <START> for (Object stringJsonObject : results) { <END> CustomerInfo aTransformedCustomer = mapper.readValue(stringJsonObject.toString(),CustomerInfo.class); assertFalse(aTransformedCustomer.getAddress().matches("[A-Z]")); assertThat(aTransformedCustomer.getAge(), Matchers.lessThanOrEqualTo(POJOGenerator.MAX_YEAR_DIFF_RANGE)); assertThat(aTransformedCustomer.getName().length(), Matchers.lessThanOrEqualTo(maxLengthOfCustomerName)); } }</code><technical_language>stringJsonObject is CustomerInfo, right? need need for toString parse again</technical_language>

Target:
private void assertTransformationsGenerated(SimpleTransformApplication simpleTransformApplication) throws IOException { int maxLengthOfCustomerName = 1 + ( 2 * simpleTransformApplication.pojoDataGenerator.getMaxNameLength()); for (Object customerInfoObject : results) { CustomerInfo aTransformedCustomer = (CustomerInfo)customerInfoObject; assertFalse(aTransformedCustomer.getAddress().matches("[A-Z]")); assertThat(aTransformedCustomer.getAge(), Matchers.lessThanOrEqualTo(POJOGenerator.MAX_YEAR_DIFF_RANGE)); assertThat(aTransformedCustomer.getName().length(), Matchers.lessThanOrEqualTo(maxLengthOfCustomerName)); } }
Source:
<code>public byte[] getStitchesBytes(ArrayList<StitchPoint> stitchPoints) { int xChange; int yChange; StitchPoint currentPoint = stitchPoints.get(0); ByteArray stitchBytes = new ByteArray(); for (int i = 0; i < stitchPoints.size(); i++) { StitchPoint nextPoint = stitchPoints.get(i); xChange = (int) (nextPoint.point.x - currentPoint.point.x); yChange = (int) (nextPoint.point.y - currentPoint.point.y); int xValue = (xChange < 0 ? CONVERSIONTABLE[(xChange * (-1)) + 121] : CONVERSIONTABLE[xChange]); int yValue = (yChange < 0 ? CONVERSIONTABLE[(yChange * (-1)) + 121] : CONVERSIONTABLE[yChange]); stitchBytes.addAll(getBytesForStitchPoint(xValue, yValue, currentPoint.jump)); <START> currentPoint = nextPoint; <END> } return stitchBytes.toArray(); }</code><technical_language>I sense move getBytesForStitchPoint StitchPoint class rename (getBytes). calculation of a stitchpoint xValue, yValue currentPoint.jump a method in StitchPoint class well. pleasant currentPoint.delta(nextPoint).getBytes() (I a name describes is happening delta, I fully understand is on)</technical_language>

Target:
public byte[] getStitchesBytes(ArrayList<StitchPoint> stitchPoints) { int xChange; int yChange; StitchPoint currentPoint = stitchPoints.get(0); ByteArray stitchBytes = new ByteArray(); for (int i = 0; i < stitchPoints.size(); i++) { StitchPoint nextPoint = stitchPoints.get(i); xChange = (int) (nextPoint.point.x - currentPoint.point.x); yChange = (int) (nextPoint.point.y - currentPoint.point.y); int xValue = (xChange < 0 ? CONVERSION_TABLE[(xChange * (-1)) + 121] : CONVERSION_TABLE[xChange]); int yValue = (yChange < 0 ? CONVERSION_TABLE[(yChange * (-1)) + 121] : CONVERSION_TABLE[yChange]); stitchBytes.addAll(getBytesForStitchPoint(xValue, yValue, currentPoint.jump)); currentPoint = nextPoint; } return stitchBytes.toArray(); }
Source:
<code>public FunctionImplementation getForTypes(List<DataType> dataTypes) throws IllegalArgumentException { assert dataTypes.size() == 2 : "Arithmetic operator must receive two arguments"; if (dataTypes.get(0).equals(dataTypes.get(1))) { DataType dataType = dataTypes.get(0); final BinaryScalar<?> scalar; switch (dataType.id()) { case DoubleType.ID: scalar = new BinaryScalar<>(doubleFunction, name, DataTypes.DOUBLE, features); break; case FloatType.ID: scalar = new BinaryScalar<>(floatFunction, name, DataTypes.FLOAT, features); break; case ByteType.ID: case ShortType.ID: case IntegerType.ID: scalar = new BinaryScalar<>(integerFunction, name, DataTypes.INTEGER, features); break; case LongType.ID: case TimestampType.ID_WITH_TZ: case TimestampType.ID_WITHOUT_TZ: scalar = new BinaryScalar<>(longFunction, name, DataTypes.LONG, features); break; default: throw new UnsupportedOperationException( operator + " is not supported on expressions of type " + dataType.getName()); } return Scalar.withOperator(scalar, operator); } DataType fst = dataTypes.get(0); DataType snd = dataTypes.get(1); if (snd.id() == IntervalType.ID) { switch (fst.id()) { case TimestampType.ID_WITH_TZ: case TimestampType.ID_WITHOUT_TZ: return new IntervalToTimestampScalar(operator); default: <START> throw new UnsupportedOperationException("Invalid operator on intervals"); <END> } } throw new UnsupportedOperationException("Invalid operation"); }</code><technical_language>More descriptive error message great</technical_language>

Target:
public FunctionImplementation getForTypes(List<DataType> dataTypes) throws IllegalArgumentException { assert dataTypes.size() == 2 : "Arithmetic operator must receive two arguments"; DataType fst = dataTypes.get(0); DataType snd = dataTypes.get(1); if (fst.equals(snd)) { final Scalar<?, ?> scalar; switch (fst.id()) { case DoubleType.ID: scalar = new BinaryScalar<>(doubleFunction, name, DataTypes.DOUBLE, features); break; case FloatType.ID: scalar = new BinaryScalar<>(floatFunction, name, DataTypes.FLOAT, features); break; case ByteType.ID: case ShortType.ID: case IntegerType.ID: scalar = new BinaryScalar<>(integerFunction, name, DataTypes.INTEGER, features); break; case IntervalType.ID: scalar = new IntervalArithmeticScalar(operator, name); break; case LongType.ID: case TimestampType.ID_WITH_TZ: case TimestampType.ID_WITHOUT_TZ: scalar = new BinaryScalar<>(longFunction, name, DataTypes.LONG, features); break; default: throw new UnsupportedOperationException( operator + " is not supported on expressions of type " + fst.getName()); } return Scalar.withOperator(scalar, operator); } if (isInterval(fst) && isTimestamp(snd)) { return new IntervalTimestampScalar(operator, name, fst, snd, snd); } if (isTimestamp(fst) && isInterval(snd)) { return new IntervalTimestampScalar(operator, name, fst, snd, fst); } throw new UnsupportedOperationException( String.format(Locale.ENGLISH, "Arithmetic operation are not supported for type %s %s", fst, snd)); }
Source:
<code>public void testThrottlingRoutePolicyStartWithAlwaysOpenOn() throws Exception { log.debug("---- sending some messages"); for (int i = 0; i < size; i++) { template.sendBody(url, "Message " + i); Thread.sleep(3); } <START> Thread.sleep(2000); <END> result.expectedMessageCount(0); result.setResultWaitTime(1000); assertMockEndpointsSatisfied(); }</code><technical_language>Is a sleep for 2 seconds, this test takes 5+ seconds run, nice fast unit tests of camel-core</technical_language>

Target:
public void testThrottlingRoutePolicyStartWithAlwaysOpenOn() throws Exception { log.debug("---- sending some messages"); for (int i = 0; i < size; i++) { template.sendBody(url, "Message " + i); Thread.sleep(3); } Thread.sleep(500); result.expectedMessageCount(0); result.setResultWaitTime(1000); assertMockEndpointsSatisfied(); }
Source:
<code>private void runReadRequest(OpcUaRequestInfo requestInfo) { <START> ChannelRecord record = requestInfo.driverRecord; <END> final NodeId nodeId = new NodeId(requestInfo.nodeNamespaceIndex, requestInfo.nodeId); final VariableNode node = this.client.getAddressSpace().createVariableNode(nodeId); Object readResult = null; try { logger.debug("reading: ns={};s={}..", requestInfo.nodeNamespaceIndex, requestInfo.nodeId); readResult = extractValue(runSafe(node.readValue())); logger.debug("Read Successful"); } catch (final Exception e) { record.setChannelStatus(new ChannelStatus(ChannelFlag.FAILURE, message.readFailed(), e)); record.setTimestamp(System.currentTimeMillis()); logger.warn(message.readFailed(), e); return; } final Optional<TypedValue<?>> typedValue = this.getTypedValue(requestInfo.dataType, readResult); if (!typedValue.isPresent()) { record.setChannelStatus(new ChannelStatus(FAILURE, message.errorValueTypeConversion(), null)); record.setTimestamp(System.currentTimeMillis()); return; } record.setValue(typedValue.get()); record.setChannelStatus(new ChannelStatus(SUCCESS)); record.setTimestamp(System.currentTimeMillis()); }</code><technical_language>change field name driverRecord in OpcUaRequestInfo</technical_language>

Target:
private void runReadRequest(OpcUaRequestInfo requestInfo) { ChannelRecord record = requestInfo.channelRecord; final NodeId nodeId = new NodeId(requestInfo.nodeNamespaceIndex, requestInfo.nodeId); final VariableNode node = this.client.getAddressSpace().createVariableNode(nodeId); Object readResult = null; try { logger.debug("reading: ns={};s={}..", requestInfo.nodeNamespaceIndex, requestInfo.nodeId); readResult = extractValue(runSafe(node.readValue())); logger.debug("Read Successful"); } catch (final Exception e) { record.setChannelStatus(new ChannelStatus(ChannelFlag.FAILURE, message.readFailed(), e)); record.setTimestamp(System.currentTimeMillis()); logger.warn(message.readFailed(), e); return; } final Optional<TypedValue<?>> typedValue = this.getTypedValue(requestInfo.dataType, readResult); if (!typedValue.isPresent()) { record.setChannelStatus(new ChannelStatus(FAILURE, message.errorValueTypeConversion(), null)); record.setTimestamp(System.currentTimeMillis()); return; } record.setValue(typedValue.get()); record.setChannelStatus(new ChannelStatus(SUCCESS)); record.setTimestamp(System.currentTimeMillis()); }
Source:
<code>private static void collectRecursivelyAllLegalChildren(VirtualFile currentDir, String currentPrefix, Map<String, VirtualFile> nameToFiles) throws IOException { if (currentDir.isFile()) { if (currentDir.isDescendant("")) { nameToFiles.put(currentPrefix, currentDir); } } else { if (!currentPrefix.isEmpty()) { currentPrefix += "/"; } List<VirtualFile> children = currentDir.listOnlyDescendants(); <START> for (int i = 0; i < children.size(); i++) { <END> VirtualFile child = children.get(i); collectRecursivelyAllLegalChildren(child, currentPrefix + child.getName(), nameToFiles); } } }</code><technical_language>te implicit for loop</technical_language>

Target:
private static void collectRecursivelyAllLegalChildren(VirtualFile currentDir, String currentPrefix, Map<String, VirtualFile> nameToFiles) throws IOException { if (currentDir.isFile()) { if (currentDir.isDescendant("")) { nameToFiles.put(currentPrefix, currentDir); } } else { if (!currentPrefix.isEmpty()) { currentPrefix += "/"; } List<VirtualFile> children = currentDir.listOnlyDescendants(); for (VirtualFile child : children) { collectRecursivelyAllLegalChildren(child, currentPrefix + child.getName(), nameToFiles); } } }
Source:
<code>public static Object[][] adsVelesTracking() { <START> final String TURN_ON_VELES = "?InstantGlobals.wgAdDriverVelesBidderCountries=[XX]"; <END> return new Object[][]{ { new Page(WIKI_SPECIAL, "SyntheticTests/RTB/Prebid.js/Veles/Both/Leaderboard" + TURN_ON_VELES), ImmutableMap.builder() .put(AdsContent.TOP_LB, "20.00") .put(AdsContent.INCONTENT_PLAYER, "USED") .build() }, { new Page(WIKI_SPECIAL, "SyntheticTests/RTB/Prebid.js/Veles" + TURN_ON_VELES), ImmutableMap.builder() .put(AdsContent.TOP_LB, "20.00") .put(AdsContent.INCONTENT_PLAYER, "20.00") .build() }, { new Page(WIKI_SPECIAL, "Project43_Wikia" + TURN_ON_VELES), ImmutableMap.builder() .put(AdsContent.TOP_LB, "0.00") .build() }, { new Page(WIKI_SPECIAL, "SyntheticTests/RTB/Prebid.js/Veles/Incontent" + TURN_ON_VELES), ImmutableMap.builder() .put(AdsContent.TOP_LB, "NOT_INVOLVED") .put(AdsContent.INCONTENT_PLAYER, "20.00") .build() }, { new Page(WIKI_SPECIAL, "SyntheticTests/RTB/Prebid.js/Veles/Leaderboard" + TURN_ON_VELES), ImmutableMap.builder() .put(AdsContent.TOP_LB, "20.00") .put(AdsContent.INCONTENT_PLAYER, "NOT_INVOLVED") .build() } }; }</code><technical_language>![image](<LINK_0></technical_language>

Target:
public static Object[][] adsVelesTracking() { return new Object[][]{ { new Page(WIKI_SPECIAL, "SyntheticTests/RTB/Prebid.js/Veles?" + AdsVeles.TURN_ON_QUERY_PARAM), ImmutableMap.builder() .put(AdsContent.TOP_LB, "20.00") .put(AdsContent.INCONTENT_PLAYER, "20.00") .build() }, { new Page(WIKI_SPECIAL, "SyntheticTests/RTB/Prebid.js/Veles/Incontent?" + AdsVeles.TURN_ON_QUERY_PARAM), ImmutableMap.builder() .put(AdsContent.TOP_LB, "NOT_INVOLVED") .put(AdsContent.INCONTENT_PLAYER, "20.00") .build() }, { new Page(WIKI_SPECIAL, "SyntheticTests/RTB/Prebid.js/Veles/Leaderboard?" + AdsVeles.TURN_ON_QUERY_PARAM), ImmutableMap.builder() .put(AdsContent.TOP_LB, "20.00") .put(AdsContent.INCONTENT_PLAYER, "NOT_INVOLVED") .build() } }; }
Source:
<code>public static boolean isSelectTextTutorialEnabled() { <START> return !getBoolean(R.string.preference_key_select_text_tutorial_enabled, false); <END> }</code><technical_language>reasoning here? This highlight tooltip shown time (in 1-minute intervals)</technical_language>

Target:
public static boolean isSelectTextTutorialEnabled() { return getBoolean(R.string.preference_key_select_text_tutorial_enabled, true); }
Source:
<code>public int compareTo(MacOsVersion o) { int compareTo = Integer.valueOf(fMajorVersion).compareTo(o.getMajorVersion()); if (compareTo != 0) { return compareTo; } compareTo = Integer.valueOf(fMinorVersion).compareTo(o.getMinorVersion()); if (compareTo != 0) { return compareTo; } <START> return Integer.valueOf(fBugFixVersion).compareTo(o.getBugFixVersion()); <END> }</code><technical_language>question: return Integer.compareTo(fBugFixVersion, o.getBugfixVersion());</technical_language>

Target:
public int compareTo(MacOsVersion o) { int compareTo = Integer.compare(fMajorVersion, o.getMajorVersion()); if (compareTo != 0) { return compareTo; } compareTo = Integer.compare(fMinorVersion, o.getMinorVersion()); if (compareTo != 0) { return compareTo; } return Integer.compare(fBugFixVersion, o.getBugFixVersion()); }
Source:
<code>public TestHiveDistributedQueriesWithOptimizedRepartitioning() { super(() -> HiveQueryRunner.createQueryRunner( getTables(), <START> ImmutableMap.of("experimental.optimized-repartitioning", "true", <END> "driver.max-page-partitioning-buffer-size", "200B"), Optional.empty())); }</code><technical_language>nit: ImmutableMap.of( "experimental.optimized-repartitioning", "true", "driver.max-page-partitioning-buffer-size", "200B"), ); Also, 200B small for partitioning buffer size</technical_language>

Target:
public TestHiveDistributedQueriesWithOptimizedRepartitioning() { super(() -> HiveQueryRunner.createQueryRunner( getTables(), ImmutableMap.of( "experimental.optimized-repartitioning", "true", "driver.max-page-partitioning-buffer-size", "10000B"), Optional.empty())); }
Source:
<code>void call(Metric<T> dataPoint) throws IOException; } private final HttpServletRequest request; private final HttpServletResponse response; private final JsonGenerator generator; private final ObjectMapper mapper; private AtomicInteger count; private final ByteArrayOutputStream jsonOutputStream; private volatile Metric<T> current; public MetricObserver(HttpServletRequest request, HttpServletResponse response, ObjectMapper mapper) { this.request = request; this.response = response; this.mapper = mapper; count = new AtomicInteger(); jsonOutputStream = new ByteArrayOutputStream(); try { generator = mapper.getFactory().createGenerator(response.getOutputStream(), JsonEncoding.UTF8); <START> generator.writeStartArray(); <END> } catch (IOException e) { throw new RuntimeException(e); } }</code><technical_language>this happen onNext (when count.incrementAndGet() == 1) ? write this generator if write else (only 204 code)</technical_language>

Target:
void call(Metric<T> dataPoint) throws IOException; } private final AsyncContext asyncContext; private final HttpServletRequest request; private final HttpServletResponse response; private final JsonGenerator generator; private final ObjectMapper mapper; private AtomicInteger count; private volatile Metric<T> current; public MetricObserver(AsyncContext asyncContext, ObjectMapper mapper, String extraAccesControlAllowHeaders) { this.asyncContext = asyncContext; request = (HttpServletRequest) asyncContext.getRequest(); response = (HttpServletResponse) asyncContext.getResponse(); this.mapper = mapper; count = new AtomicInteger(); setCorsHeaders(extraAccesControlAllowHeaders); try { generator = mapper.getFactory().createGenerator(response.getOutputStream(), JsonEncoding.UTF8); generator.writeStartArray(); } catch (IOException e) { throw new RuntimeException(e); } }
Source:
<code>public IAtsProgram getProgram(IAtsWorkItem workItem) { <START> return null; <END> }</code><technical_language>This this right? throw a supported exception</technical_language>

Target:
public IAtsProgram getProgram(IAtsWorkItem workItem) { throw new UnsupportedOperationException("Not implemented yet"); }
Source:
<code>private Topic getOrCreateTopic(MessageID messageId) throws JMSException { Topic topic = topicCache.get(messageId.getId()); if (topic == null) { topic = session.createTopic(messageId.getId()); Topic <START> catchReturn = <END> topicCache.putIfAbsent(messageId.getId(), topic); } return topic; }</code><technical_language>This variable is used. reason include calling a non-void method require catching return object typically. satisfy Findbugs, do this: if (topic == null) { topic = session.createTopic(messageId.getId()); return topicCache.putIfAbsent(messageId.getId(), topic); } return topic;</technical_language>

Target:
private Topic getOrCreateTopic(MessageID messageId) throws JMSException { Topic topic = topicCache.get(messageId.getId()); if (topic == null) { topic = session.createTopic(messageId.getId()); topicCache.put(messageId.getId(), topic); } return topic; }
Source:
<code>@Override public @Nullable IStrategoTerm invoke(ILanguageImpl impl, FileObject location, IStrategoTerm input, String strategy) throws MetaborgException { List<MetaborgException> exceptions = Lists.newArrayList(); for(ILanguageComponent component : impl.components()) { <START> if(component.facet(DynamicClassLoadingFacet.class) == null) { <END> continue; } final HybridInterpreter runtime = strategoRuntimeService.runtime(component, location, true); try { final IStrategoTerm result = invoke(runtime, input, strategy); return result; } catch(MetaborgException ex) { exceptions.add(ex); } } throw new AggregateMetaborgException(exceptions); }</code><technical_language>I this method call invoke(ILanguageComponent, FileObject, IStrategoTerm, String), exist yet</technical_language>

Target:
@Override public @Nullable IStrategoTerm invoke(ILanguageImpl impl, FileObject location, IStrategoTerm input, String strategy) throws MetaborgException { List<MetaborgException> exceptions = Lists.newArrayList(); for(ILanguageComponent component : impl.components()) { if(!IStrategoCommon.hasStrategoFacets(component)) { continue; } final HybridInterpreter runtime = strategoRuntimeService.runtime(component, location, true); try { final IStrategoTerm result = invoke(runtime, input, strategy); return result; } catch(MetaborgException ex) { exceptions.add(ex); } } throw new AggregateMetaborgException(exceptions); }
Source:
<code>public void onCreate() { super.onCreate(); OneSignal.setLogLevel(OneSignal.LOG_LEVEL.VERBOSE, OneSignal.LOG_LEVEL.NONE); String appId = OneSignalPrefs.getOneSignalAppId(this); if (appId == null) { appId = "380dc082-5231-4cc2-ab51-a03da5a0e4c2"; OneSignalPrefs.cacheOneSignalAppId(this, appId); } OneSignal.setAppId(appId); OneSignal.setAppContext(this); <START> OneSignal.unsubscribeWhenNotificationsAreDisabled(true); <END> OneSignal.setInFocusDisplaying(OneSignal.OSInFocusDisplayOption.Notification); OneSignal.pauseInAppMessages(true); Log.d(Tag.DEBUG, Text.ONESIGNAL_SDK_INIT); }</code><technical_language>keeping this public method for a reason? Isnt this a remote param keeping both</technical_language>

Target:
public void onCreate() { super.onCreate(); OneSignal.setLogLevel(OneSignal.LOG_LEVEL.VERBOSE, OneSignal.LOG_LEVEL.NONE); String appId = OneSignalPrefs.getOneSignalAppId(this); if (appId == null) { appId = "380dc082-5231-4cc2-ab51-a03da5a0e4c2"; OneSignalPrefs.cacheOneSignalAppId(this, appId); } OneSignal.setAppId(appId); OneSignal.setAppContext(this); OneSignal.setInFocusDisplaying(OneSignal.OSInFocusDisplayOption.Notification); OneSignal.pauseInAppMessages(true); Log.d(Tag.DEBUG, Text.ONESIGNAL_SDK_INIT); }
Source:
<code>public void customClassPrefixAndSuffixNoJavaType() throws ClassNotFoundException { ClassLoader resultsClassLoader = generateAndCompile("/schema/properties/primitivePropertiesNoJavaType.json", "com.example", config("classNamePrefix", "prefix", "classNameSuffix","Suffix")); <START> resultsClassLoader.loadClass("com.example.PrefixprimitivePropertiesNoJavaTypeSuffix"); <END> }</code><technical_language>com.example.PrefixPrimitivePropertiesNoJavaTypeSuffix</technical_language>

Target:
public void customClassPrefixAndSuffixNoJavaType() throws ClassNotFoundException { ClassLoader resultsClassLoader = generateAndCompile("/schema/properties/primitivePropertiesNoJavaType.json", "com.example", config("classNamePrefix", "Prefix", "classNameSuffix","Suffix")); resultsClassLoader.loadClass("com.example.PrefixPrimitivePropertiesNoJavaTypeSuffix"); }
Source:
<code>public void testBucketOneSizeThreeBucketTwoSizeFiveStartWithOne() { TwoBucket twoBucket = new TwoBucket(3, 5, 1, "one"); <START> assertEquals(twoBucket.getTotalMoves(), 4); <END> assertEquals(twoBucket.getFinalBucket(), "one"); assertEquals(twoBucket.getOtherBucket(), 5); }</code><technical_language>[assertEquals](<LINK_0> takes expected argument actual this (and assertions) be: assertEquals(4, twoBucket.getTotalMoves()); error message confusing</technical_language>

Target:
public void testBucketOneSizeThreeBucketTwoSizeFiveStartWithOne() { TwoBucket twoBucket = new TwoBucket(3, 5, 1, "one"); assertEquals(4, twoBucket.getTotalMoves()); assertEquals("one", twoBucket.getFinalBucket()); assertEquals(5, twoBucket.getOtherBucket()); }
Source:
<code>public EncoderDecoderFactoryBean(Encoding encoding) { <START> this.encoding = encoding; <END> }</code><technical_language>Assert.notNull()</technical_language>

Target:
public EncoderDecoderFactoryBean(Encoding encoding) { Assert.notNull(encoding, "'encoding' cannot be null"); this.encoding = encoding; }
Source:
<code>public Fragment getItem(int i) { <START> Patient patient = new PatientDAO().findPatientByID(mPatientId); <END> switch (i) { case DETAILS_TAB_POS: PatientDetailsFragment patientDetailsFragment = PatientDetailsFragment.newInstance(patient .getPerson() .getName() .getNameString(), patient.getIdentifier().getIdentifier(), patient.getId()); new PatientDashboardDetailsPresenter(mPatientId, patientDetailsFragment); return patientDetailsFragment; case DIAGNOSIS_TAB_POS: PatientDiagnosisFragment patientDiagnosisFragment = PatientDiagnosisFragment.newInstance(); new PatientDashboardDiagnosisPresenter(mPatientId, patientDiagnosisFragment); return patientDiagnosisFragment; case VISITS_TAB_POS: PatientVisitsFragment patientVisitsFragment = PatientVisitsFragment.newInstance(); new PatientDashboardVisitsPresenter(mPatientId, patientVisitsFragment); return patientVisitsFragment; case VITALS_TAB_POS: PatientVitalsFragment patientVitalsFragment = PatientVitalsFragment.newInstance(); new PatientDashboardVitalsPresenter(mPatientId, patientVitalsFragment); return patientVitalsFragment; default: return null; } }</code><technical_language>adapter is part of view, presenter access dao</technical_language>

Target:
public Fragment getItem(int i) { switch (i) { case DETAILS_TAB_POS: PatientDetailsFragment patientDetailsFragment = PatientDetailsFragment.newInstance(); new PatientDashboardDetailsPresenter(mPatientId, patientDetailsFragment); return patientDetailsFragment; case DIAGNOSIS_TAB_POS: PatientDiagnosisFragment patientDiagnosisFragment = PatientDiagnosisFragment.newInstance(); new PatientDashboardDiagnosisPresenter(mPatientId, patientDiagnosisFragment); return patientDiagnosisFragment; case VISITS_TAB_POS: PatientVisitsFragment patientVisitsFragment = PatientVisitsFragment.newInstance(); new PatientDashboardVisitsPresenter(mPatientId, patientVisitsFragment); return patientVisitsFragment; case VITALS_TAB_POS: PatientVitalsFragment patientVitalsFragment = PatientVitalsFragment.newInstance(); new PatientDashboardVitalsPresenter(mPatientId, patientVitalsFragment); return patientVitalsFragment; default: return null; } }
Source:
<code>private <T> Sequence<T> runQuery(final Query<T> query) { Hook.QUERY_PLAN.run(query); <START> return queryLifecycleFactory.factorize().runSimple(query, null, null, null, false); <END> }</code><technical_language>pass auth information QueryLifecycle. harm in checking twice, if good enough for Santa Claus good enough for us. Checking allow get rid of no-auth path in QueryLifecycle, good. a good place stuff auth token is PlannerContext</technical_language>

Target:
private <T> Sequence<T> runQuery(final Query<T> query) { Hook.QUERY_PLAN.run(query); final AuthenticationResult authenticationResult = plannerContext.getAuthenticationResult(); return queryLifecycleFactory.factorize().runSimple(query, authenticationResult, null); }
Source:
<code>private boolean doSave(String path, String fileType, String encoding, ProgressIndicator progress) { boolean didSave = false; try { didSave = doSaveImpl(path, fileType, encoding, progress); } catch (Exception ex) { Debug.log("Exception occurred during save: "); Debug.logException(ex); if (progress != null) { progress.onError("Could not save " + path + ": " + ex.getMessage()); } } <START> final boolean saved = didSave; <END> Scheduler.get().scheduleDeferred(new ScheduledCommand() { @Override public void execute() { if (!saved) return; if (docDisplay_.isVimModeOn()) { String oldMarksSpec = ""; if (hasProperty("marks")) oldMarksSpec = getProperty("marks"); String newMarksSpec = VimMarks.encode(docDisplay_.getMarks()); if (!oldMarksSpec.equals(newMarksSpec)) setProperty("marks", newMarksSpec); } String oldRangeSpec = ""; if (hasProperty("selection")) oldRangeSpec = getProperty("selection"); String newRangeSpec = Range.encode(docDisplay_.getSelectionRange()); if (!oldRangeSpec.equals(newRangeSpec)) setProperty("selection", newRangeSpec); } }); return saved; }</code><technical_language>main concern this save is autosaves happen a edit, is plenty of time move cursor. position save restore is (a) edit, (b) left cursor, "somewhere near" edit, feel predictable</technical_language>

Target:
private boolean doSave(String path, String fileType, String encoding, ProgressIndicator progress) { boolean didSave = false; try { didSave = doSaveImpl(path, fileType, encoding, progress); } catch (Exception ex) { Debug.log("Exception occurred during save: "); Debug.logException(ex); if (progress != null) { progress.onError("Could not save " + path + ": " + ex.getMessage()); } } return didSave; }
Source:
<code>public void onStockMediaListFetched(StockMediaStore.OnStockMediaListFetched event) { mIsFetching = false; showProgress(false); if (event.isError()) { AppLog.e(AppLog.T.MEDIA, "An error occurred while searching stock media"); mCanLoadMore = false; return; } <START> if (mSearchQuery == null || !mSearchQuery.equals(event.searchTerm)) { <END> return; } mNextPage = event.nextPage; mCanLoadMore = event.canLoadMore; if (event.nextPage == 2) { mAdapter.setMediaList(event.mediaList); } else { mAdapter.addMediaList(event.mediaList); } showEmptyView(mAdapter.isEmpty() && !TextUtils.isEmpty(mSearchQuery)); }</code><technical_language>I this happen do else. user is a slow writer connection is slow. user writes rando starts a fetch writing complete random initial fetch results received. In this case, interested in random receive result for rando mark mIsFetching = false handle errors related it. Hope sense</technical_language>

Target:
public void onStockMediaListFetched(StockMediaStore.OnStockMediaListFetched event) { if (mSearchQuery == null || !mSearchQuery.equals(event.searchTerm)) { return; } mIsFetching = false; showProgress(false); if (event.isError()) { AppLog.e(AppLog.T.MEDIA, "An error occurred while searching stock media"); ToastUtils.showToast(this, R.string.media_generic_error); mCanLoadMore = false; return; } mNextPage = event.nextPage; mCanLoadMore = event.canLoadMore; if (event.nextPage == 2) { mAdapter.setMediaList(event.mediaList); } else { mAdapter.addMediaList(event.mediaList); } showEmptyView(mAdapter.isEmpty() && !TextUtils.isEmpty(mSearchQuery)); }
Source:
<code>public void visitReturnStatement(ReturnStatementTree tree) { if (isWithinCallingMethodBody(tree) && returnsIntegerMinValue(tree.expression())) { addIssue(tree, "Simply return -1"); } <START> super.visitReturnStatement(tree); <END> }</code><technical_language>uncessary call super. need visit further</technical_language>

Target:
public void visitReturnStatement(ReturnStatementTree tree) { if (returnsIntegerMinValue(tree.expression())) { addIssue(tree, "Simply return -1"); } }
Source:
<code>public boolean isRetryable(int statusCode) { if (statusCode == 400) { logger.info("No data retrieved."); return true; } else if (statusCode == 401) { logger.info("Authentication failure: invalid login credentials. Check logs for details."); return false; } else if (statusCode == 403) { logger.info("Authorization failure or invalid license. Check logs for details."); return false; } else if (statusCode == 404) { logger.info("Endpoint does not exist."); return true; <START> } else if (statusCode > 500 && statusCode < 600) { <END> logger.info("Unrecoverable server error."); return true; } return false; }</code><technical_language>suggestion } else if (statusCode >= 500 && statusCode < 600) {</technical_language>

Target:
public boolean isRetryable(int statusCode) { if (statusCode == 400) { logger.info("No data retrieved."); return true; } else if (statusCode == 401) { logger.info("Authentication failure: invalid login credentials. Check logs for details."); return false; } else if (statusCode == 403) { logger.info("Authorization failure or invalid license. Check logs for details."); return false; } else if (statusCode == 404) { logger.info("Endpoint does not exist."); return true; } else if (statusCode >= 500 && statusCode < 600) { logger.info("Unrecoverable server error."); return true; } return false; }
Source:
<code>private void saveToDb(AuditLogableBase auditLogable, AuditLogType logType, String loggerString) { AuditLogSeverity severity = logType.getSeverity(); AuditLog auditLog = createAuditLog(auditLogable, logType, loggerString, severity); if (auditLog == null) { log.warn("Unable to create AuditLog"); } else { setPropertiesFromAuditLogableBase(auditLogable, auditLog); try { <START> getDbFacadeInstance().getAuditLogDao().save(auditLog); <END> } catch (Exception ex) { log.error("Unable to save audit log : to database : {}", getMessageToLog(loggerString, auditLog), ex.getMessage()); } logMessage(severity, getMessageToLog(loggerString, auditLog)); } }</code><technical_language>while of this try-catch block for rare cases - i in suggested scenario bug, attempt write user actions audit log is doomed fail, extending field definition trim in AuditLogDao.save(auditLog) Adding Eli share thoughts</technical_language>

Target:
private void saveToDb(AuditLogableBase auditLogable, AuditLogType logType, String loggerString) { AuditLogSeverity severity = logType.getSeverity(); AuditLog auditLog = createAuditLog(auditLogable, logType, loggerString, severity); if (auditLog == null) { log.warn("Unable to create AuditLog"); } else { setPropertiesFromAuditLogableBase(auditLogable, auditLog); getDbFacadeInstance().getAuditLogDao().save(auditLog); logMessage(severity, getMessageToLog(loggerString, auditLog)); } }
Source:
<code><START> public Optional<List<String>> getDefaultFieldPhrases() { <END> return Optional.ofNullable(defaultField); }</code><technical_language>considered bad practice optional a list. return empty list, instead of empty optional</technical_language>

Target:
public List<String> getDefaultFieldPhrases() { return defaultField; }
Source:
<code>private String getApplication() { String application = "Talend-"; <START> if (!StringUtils.isEmpty(talendProductVersion)) { <END> application += talendProductVersion; } return application; }</code><technical_language>1. If StringUtils, refer method isNotEmpty more informative, for me. 2. if talendProductVersion is null, set appName "Talend-" ? Is name if version is missing</technical_language>

Target:
private String getApplication() { StringBuilder application = new StringBuilder(); application.append("Talend"); if (StringUtils.isNotEmpty(talendProductVersion)) { application.append('-'); application.append(talendProductVersion); } return application.toString(); }
Source:
<code>public synchronized boolean registerConnection(L2GameClient client) { if (ConfigData.DUALBOX_PROTECTION_ENABLED) { IpPack pack = new IpPack(client.getConnection().getInetAddress().getHostAddress(), client.getTrace()); Integer count = _address.get(pack); if (count == null) { _address.put(pack, count = 1); } <START> if (count < ConfigData.DUALBOX_MAX_ALLOWED) <END> { _address.put(pack, count =+ 1); } else { _address.put(pack, count =+ 0); return false; } } return true; }</code><technical_language>So, if count is null, 1. enters in this block, add another 1, count 2 for client. I suggest this: java Integer count = _address.get(pack) == null ? 0 : _address.get(pack); if (count < ConfigData.DUALBOX_MAX_ALLOWED) { _address.put(pack, count =+ 1); return true; } return false;</technical_language>

Target:
public synchronized boolean registerConnection(L2GameClient client) { if (ConfigData.DUALBOX_PROTECTION_ENABLED) { try { IpPack pack = new IpPack(client.getConnection().getInetAddress().getHostAddress(), client.getTrace()); Integer count = _address.get(pack) == null ? 0 : _address.get(pack); if (count < ConfigData.DUALBOX_MAX_ALLOWED) { _address.put(pack, count =+ 1); return true; } } catch (Exception e) { e.printStackTrace(); } } return false; }
Source:
<code>public RevCommit next() throws MissingObjectException, IncorrectObjectTypeException, IOException { for (;;) { final RevCommit r = pending.next(); if (r == null) return null; if ((r.flags & UNINTERESTING) != 0) { markTreeUninteresting(r.getTree()); <START> if (r.has(BOUNDARY) && hasRevSort(RevSort.BOUNDARY)) <END> return r; continue; } if (firstCommit == null) firstCommit = r; lastCommit = r; pendingObjects.add(r.getTree()); return r; } }</code><technical_language>reason override next(), expose pendingObjects, duplicate of this code for this r.has(BOUNDARY) test? skip flag test commit</technical_language>

Target:
public RevCommit next() throws MissingObjectException, IncorrectObjectTypeException, IOException { for (;;) { final RevCommit r = super.next(); if ((r != null) && (r.flags & UNINTERESTING) != 0 && !r.has(BOUNDARY)) continue; return r; } }
Source:
<code><START> public boolean equals(Object o) <END> { if (this == o) { return true; } if (o == null || o.getClass() != getClass()) { return false; } ForeverBroadcastDistributionRule that = (ForeverBroadcastDistributionRule) o; return colocatedDatasource.equals(that.colocatedDatasource); }</code><technical_language>hashCode overridden is consistent equals</technical_language>

Target:
public boolean equals(Object o) { if (this == o) { return true; } if (o == null || o.getClass() != getClass()) { return false; } ForeverBroadcastDistributionRule that = (ForeverBroadcastDistributionRule) o; return Objects.equals(colocatedDataSources, that.colocatedDataSources); }
Source:
<code>public ASTValue eval(WordsEnvironment environment) throws WordsRuntimeException { ASTValue refList = children.get(0).eval(environment); if (refList.type == ASTValue.ValueType.NOTHING) { ASTValue id = children.get(1).eval(environment); try { WordsObject obj = environment.getObject(id.stringValue); return new ASTValue(obj); } catch (WordsObjectNotFoundException e) { throw new WordsReferenceException("Value expression is not an object"); } } WordsObject obj = refList.objValue; <START> if (obj == null) { <END> throw new WordsReferenceException("Value expression is not an object"); } ASTValue id = children.get(1).eval(environment); String propName = id.stringValue; WordsProperty wordsProp = obj.getProperty(propName); ASTValue astValue = null; switch (wordsProp.type) { case STRING: astValue = new ASTValue(wordsProp.stringProperty); break; case NUM: astValue = new ASTValue(wordsProp.numProperty); break; case OBJECT: astValue = new ASTValue(wordsProp.objProperty); break; case NOTHING: astValue = new ASTValue(ASTValue.ValueType.NOTHING); break; default: new AssertionError("Shouldn't get here in INodeRetrieveProperty"); } return astValue; }</code><technical_language>Is this condition possible? If INodeReferenceList throw exception, returns (which is handled above) object (which is here). I obj null. If agree, this assertion, is more appropriate</technical_language>

Target:
public ASTValue eval(WordsEnvironment environment) throws WordsRuntimeException { ASTValue refList = children.get(0).eval(environment); if (refList.type == ASTValue.ValueType.NOTHING) { ASTValue id = children.get(1).eval(environment); WordsObject obj = environment.getObject(id.stringValue); return new ASTValue(obj); } WordsObject obj = refList.objValue; if (obj == null) { throw new AssertionError("obj shouldn't be null"); } ASTValue id = children.get(1).eval(environment); String propName = id.stringValue; WordsProperty wordsProp = obj.getProperty(propName); ASTValue astValue = null; switch (wordsProp.type) { case STRING: astValue = new ASTValue(wordsProp.stringProperty); break; case NUM: astValue = new ASTValue(wordsProp.numProperty); break; case OBJECT: astValue = new ASTValue(wordsProp.objProperty); break; case NOTHING: astValue = new ASTValue(ASTValue.ValueType.NOTHING); break; default: throw new AssertionError("Shouldn't get here in INodeRetrieveProperty"); } return astValue; }
Source:
<code>public String getSelectedEntityName() { <START> String name = "--"; <END> if(selectedEntity != null && selectedEntity.getName() != null && !selectedEntity.getName().isEmpty()) { name = selectedEntity.getName().get(0).getValue(); } return name; }</code><technical_language>standalone instances of "--" pulled out a constant (e.g., "NULL_DISPLAY") flexibility change display later</technical_language>

Target:
public String getSelectedEntityName() { String name = NULL_DISPLAY; if (selectedEntity != null && selectedEntity.getName() != null && !selectedEntity.getName().isEmpty()) { name = selectedEntity.getName().get(0).getValue(); } return name; }