auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public ArrayList<Lecture> getLecture(final List<String> lectureId, final String userId) throws AuthenticationException, DatabaseAccessException { final long currentTime = System.currentTimeMillis(); final ArrayList<Lecture> allLectures = new ArrayList<Lecture>(); for (int lectures = lectureId.size() - 1; lectures >= 0; lectures--) { try { allLectures.add(LectureManager.mongoGetLecture(getInstance().auth, getInstance().database, lectureId.get(lectures), userId, currentTime)); } catch (DatabaseAccessException e) { LOG.info(LoggingConstants.EXCEPTION_MESSAGE, e); if (!e.isRecoverable()) { throw e; } } catch (AuthenticationException e) { <START> LOG.error("Error: {}", e); <END> if (e.getType() != AuthenticationException.INVALID_DATE) { throw e; } } } return allLectures; }</code><technical_language>constant</technical_language>

Target:
public ArrayList<Lecture> getLecture(final List<String> lectureId, final String userId) throws AuthenticationException, DatabaseAccessException { final long currentTime = System.currentTimeMillis(); final ArrayList<Lecture> allLectures = new ArrayList<Lecture>(); for (int lectures = lectureId.size() - 1; lectures >= 0; lectures--) { try { allLectures.add(LectureManager.mongoGetLecture(getInstance().auth, getInstance().database, lectureId.get(lectures), userId, currentTime)); } catch (DatabaseAccessException e) { LOG.error(LoggingConstants.EXCEPTION_MESSAGE, e); if (!e.isRecoverable()) { throw e; } } catch (AuthenticationException e) { LOG.error(LoggingConstants.EXCEPTION_MESSAGE, e); if (e.getType() != AuthenticationException.INVALID_DATE) { throw e; } } } return allLectures; }
Source:
<code>private static void logArguments(CmdLineParser parser) { Options defaultOptions = new Options(); CmdLineParser defaultParser = new CmdLineParser(defaultOptions); StringBuilder sb = <START> new StringBuilder("Swarm Client is running with the following configuration: "); <END> for (OptionHandler argument : parser.getArguments()) { logValue(sb, argument, null); } for (OptionHandler option : parser.getOptions()) { logValue(sb, option, defaultParser); } logger.info(sb.toString()); }</code><technical_language>latest change, logging provided commandline parameters, this text updated, e.g. "Client.main invoked with: "</technical_language>

Target:
private static void logArguments(CmdLineParser parser) { Options defaultOptions = new Options(); CmdLineParser defaultParser = new CmdLineParser(defaultOptions); StringBuilder sb = new StringBuilder("Client invoked with: "); for (OptionHandler argument : parser.getArguments()) { logValue(sb, argument, null); } for (OptionHandler option : parser.getOptions()) { logValue(sb, option, defaultParser); } logger.info(sb.toString()); }
Source:
<code>public void publish() { <START> this.shareToLAN(mc.playerController.getCurrentGameType(), false); <END> }</code><technical_language>this</technical_language>

Target:
public void publish() { this.shareToLAN(this.mc.playerController.getCurrentGameType(), false); }
Source:
<code>public boolean isAssignableSeveralTimes() { if (Objects.nonNull(selectedLogicalNode) && selectedLogicalNode.getData() instanceof StructureTreeNode) { StructureTreeNode structureTreeNode = (StructureTreeNode) selectedLogicalNode.getData(); <START> if (Objects.nonNull(structureTreeNode.getDataObject()) <END> && structureTreeNode.getDataObject() instanceof View) { List<TreeNode> logicalNodeSiblings = selectedLogicalNode.getParent().getParent().getChildren(); int logicalNodeIndex = logicalNodeSiblings.indexOf(selectedLogicalNode.getParent()); List<TreeNode> viewSiblbings = selectedLogicalNode.getParent().getChildren(); if (viewSiblbings.indexOf(selectedLogicalNode) == viewSiblbings.size() - 1 && logicalNodeSiblings.size() > logicalNodeIndex + 1) { TreeNode nextSibling = logicalNodeSiblings.get(logicalNodeIndex + 1); if (nextSibling.getData() instanceof StructureTreeNode) { StructureTreeNode structureTreeNodeSibling = (StructureTreeNode) nextSibling.getData(); return structureTreeNodeSibling.getDataObject() instanceof IncludedStructuralElement; } } } } return false; }</code><technical_language>suggestion if (structureTreeNode.getDataObject() instanceof View) {</technical_language>

Target:
public boolean isAssignableSeveralTimes() { if (Objects.nonNull(selectedLogicalNode) && selectedLogicalNode.getData() instanceof StructureTreeNode) { StructureTreeNode structureTreeNode = (StructureTreeNode) selectedLogicalNode.getData(); if (structureTreeNode.getDataObject() instanceof View) { List<TreeNode> logicalNodeSiblings = selectedLogicalNode.getParent().getParent().getChildren(); int logicalNodeIndex = logicalNodeSiblings.indexOf(selectedLogicalNode.getParent()); List<TreeNode> viewSiblbings = selectedLogicalNode.getParent().getChildren(); if (viewSiblbings.indexOf(selectedLogicalNode) == viewSiblbings.size() - 1 && logicalNodeSiblings.size() > logicalNodeIndex + 1) { TreeNode nextSibling = logicalNodeSiblings.get(logicalNodeIndex + 1); if (nextSibling.getData() instanceof StructureTreeNode) { StructureTreeNode structureTreeNodeSibling = (StructureTreeNode) nextSibling.getData(); return structureTreeNodeSibling.getDataObject() instanceof IncludedStructuralElement; } } } } return false; }
Source:
<code>public void should_compile_less_into_css() throws Exception { ArgumentCaptor<byte[]> captor = ArgumentCaptor.forClass(byte[].class); final File lessStyle = directory.newFile("style.less"); FileUtils.writeStringToFile(lessStyle, "@myvar:1px;body{width:@myvar}"); given(modifier.resolve("style.less")).willReturn(lessStyle); compilableFile.compile(modifier); verify(modifier).add(eq("style.css"), captor.capture()); <START> assertThat(new String(captor.getValue())).isEqualTo("body {\n width: 1px;\n}\n\n"); <END> }</code><technical_language>work windows</technical_language>

Target:
public void should_compile_less_into_css() throws Exception { final File lessStyle = directory.newFile("style.less"); FileUtils.writeStringToFile(lessStyle, "@myvar:1px;body{width:@myvar}"); given(modifier.resolve("style.less")).willReturn(lessStyle); final byte[] compilation = new CompilableFile("style.less", "style.css").compile(modifier); assertThat(new String(compilation, "UTF-8").replace("\r", "")).isEqualTo("body {\n width: 1px;\n}\n\n"); }
Source:
<code>private void returnHandle(WrappedConnection handle, boolean error) { synchronized (stateLock) { if (destroyed) return; } synchronized (handles) { handles.remove(handle); if (handles.size() == 0) { if (mcf.getConnectionListenerPlugin() != null) { try { mcf.getConnectionListenerPlugin().passivated(con); } catch (SQLException se) { mcf.log.errorDuringConnectionListenerPassivation(mcf.getJndiName(), se); } } } } <START> if (cels.size() > 0) <END> { ConnectionEvent ce = null; if (!error) { ce = new ConnectionEvent(this, ConnectionEvent.CONNECTION_CLOSED); } else { ce = new ConnectionEvent(this, ConnectionEvent.CONNECTION_ERROR_OCCURRED, new SQLException(bundle.invalidConnection())); } ce.setConnectionHandle(handle); for (ConnectionEventListener cel : cels) { if (!error) { cel.connectionClosed(ce); } else { cel.connectionErrorOccurred(ce); } } } }</code><technical_language>remove this check, is true</technical_language>

Target:
private void returnHandle(WrappedConnection handle, boolean error) { synchronized (stateLock) { if (destroyed) return; } synchronized (handles) { handles.remove(handle); if (handles.size() == 0) { if (mcf.getConnectionListenerPlugin() != null) { try { mcf.getConnectionListenerPlugin().passivated(con); } catch (SQLException se) { mcf.log.errorDuringConnectionListenerPassivation(mcf.getJndiName(), se); } } } } ConnectionEvent ce = null; if (!error) { ce = new ConnectionEvent(this, ConnectionEvent.CONNECTION_CLOSED); } else { ce = new ConnectionEvent(this, ConnectionEvent.CONNECTION_ERROR_OCCURRED, new SQLException(bundle.invalidConnection())); } ce.setConnectionHandle(handle); for (ConnectionEventListener cel : cels) { if (!error) { cel.connectionClosed(ce); } else { cel.connectionErrorOccurred(ce); } } }
Source:
<code>private IFindReplaceTarget getTarget() { return Optional.ofNullable(fFocusPart.getSourceViewer()).map(SourceViewer::getFindReplaceTarget) <START> .orElse(null); <END> }</code><technical_language>fFocusPart null</technical_language>

Target:
private IFindReplaceTarget getTarget() { return Optional.ofNullable(fFocusPart).map(MergeSourceViewer::getSourceViewer) .map(SourceViewer::getFindReplaceTarget) .orElse(null); }
Source:
<code>public void beforeStep(StepExecution stepExecution) { SourceCode sc = EnumUtils.getEnum(SourceCode.class, sourceCode); judgmentRepository.markAsNotIndexedBySourceCode(sc); <START> if (sc == null) { <END> try { solrJudgmentsServer.deleteByQuery("*:*"); } catch (SolrServerException | IOException e) { throw new RuntimeException(e); } } }</code><technical_language>Krzysiek, I great execute deleteByQuery if sc!=null slightly another delete query deletes judgments specifed sourceCode. that: String deletingQuery = "*"; if (sc != null) { deletingQuery = ... } try { solrJudgmentsServer.deleteByQuery(deletingQuery); } catch... This solution more consistent - deletion indexing</technical_language>

Target:
public void beforeStep(StepExecution stepExecution) { SourceCode sc = EnumUtils.getEnum(SourceCode.class, sourceCode); judgmentRepository.markAsNotIndexedBySourceCode(sc); String deletingQuery = (sc == null) ? "*:*" : JudgmentIndexField.SOURCE_CODE.getFieldName() + ":" + sc.name(); try { solrJudgmentsServer.deleteByQuery(deletingQuery); } catch (SolrServerException | IOException e) { throw new RuntimeException(e); } }
Source:
<code>public Object start(IApplicationContext context) throws Exception { String[] arguments = (String[]) context.getArguments().get(IApplicationContext.APPLICATION_ARGS); List<String> args = Arrays.asList(arguments); if (args.isEmpty() || args.contains("-help") || <START> Arrays.asList(arguments).contains("--help")) <END> { System.out.println(Messages.bind(Messages.CommandLineUsage)); return IApplication.EXIT_OK; } try { ResourcesPlugin.getWorkspace(); } catch (NoClassDefFoundError noClassError) { if (noClassError.getCause() instanceof ClassNotFoundException) { ClassNotFoundException classNotFoundException = (ClassNotFoundException) noClassError.getCause(); if (classNotFoundException.getException() instanceof BundleException) { BundleException bundleException = (BundleException) classNotFoundException.getException(); if (bundleException.getCause() instanceof IllegalStateException) { System.err.println(Messages.bind(Messages.WorkspaceRequired)); System.out.println(Messages.bind(Messages.CommandLineUsage)); return 1; } } } throw noClassError; } return new CodeFormatterApplication().start(context); }</code><technical_language>args</technical_language>

Target:
public Object start(IApplicationContext context) throws Exception { String[] arguments = (String[]) context.getArguments().get(IApplicationContext.APPLICATION_ARGS); List<String> args = Arrays.asList(arguments); if (args.isEmpty() || args.contains("-help") || args.contains("--help")) { System.out.println(Messages.bind(Messages.CommandLineUsage)); return IApplication.EXIT_OK; } try { ResourcesPlugin.getWorkspace(); } catch (NoClassDefFoundError noClassError) { if (noClassError.getCause() instanceof ClassNotFoundException) { ClassNotFoundException classNotFoundException = (ClassNotFoundException) noClassError.getCause(); if (classNotFoundException.getException() instanceof BundleException) { BundleException bundleException = (BundleException) classNotFoundException.getException(); if (bundleException.getCause() instanceof IllegalStateException) { System.err.println(Messages.bind(Messages.WorkspaceRequired)); System.out.println(Messages.bind(Messages.CommandLineUsage)); return 1; } } } throw noClassError; } return new CodeFormatterApplication().start(context); }
Source:
<code>public void changeConfiguration(WorkloadConfiguration configuration) { log.debug("Configuration change request received"); for (Iterator<WorkloadService> it = threads.iterator(); it.hasNext(); ){ WorkloadService workloadService = it.next(); if (workloadService.state().equals(Service.State.TERMINATED)) { samplesFromTerminatedThreads += workloadService.getSamples(); it.remove(); } } final int threadDiff = configuration.getThreads() - threads.size(); if (threadDiff < 0) { log.debug("Going to decrease thread count by {}", threadDiff); for (int i = threadDiff; i < 0; i++) { removeThread(); } } <START> if (totalSamplesRequested != configuration.getSamples()) { <END> samplesLeft.addAndGet(configuration.getSamples() - totalSamplesRequested); totalSamplesRequested = configuration.getSamples(); } if (threadDiff > 0 && (!predefinedSamplesCount() || samplesLeft.get() > 0)) { log.debug("Going to increase thread count by {}", threadDiff); for (int i = threadDiff; i > 0; i--) { addThread(); } } delay = configuration.getDelay(); log.debug("Delay should be changed to {}", delay); for (WorkloadService thread : threads) { thread.changeDelay(delay); } }</code><technical_language>support decrease of samples count. currently</technical_language>

Target:
public void changeConfiguration(WorkloadConfiguration configuration) { log.debug("Configuration change request received"); for (Iterator<WorkloadService> it = threads.iterator(); it.hasNext(); ){ WorkloadService workloadService = it.next(); if (workloadService.state().equals(Service.State.TERMINATED)) { samplesCountDoneFromTerminatedThreads += workloadService.getSamples(); it.remove(); } } final int threadDiff = configuration.getThreads() - threads.size(); if (threadDiff < 0) { log.debug("Going to decrease thread count by {}", threadDiff); for (int i = threadDiff; i < 0; i++) { removeThread(); } } if (totalSamplesCountRequested != configuration.getSamples()) { leftSamplesCount.addAndGet(configuration.getSamples() - totalSamplesCountRequested); totalSamplesCountRequested = configuration.getSamples(); } if (threadDiff > 0 && (!predefinedSamplesCount() || leftSamplesCount.get() > 0)) { log.debug("Going to increase thread count by {}", threadDiff); for (int i = threadDiff; i > 0; i--) { addThread(); } } delay = configuration.getDelay(); log.debug("Delay should be changed to {}", delay); for (WorkloadService thread : threads) { thread.changeDelay(delay); } }
Source:
<code>private Collection<IASTLiteralExpression> findAllLiterals(IProgressMonitor monitor) throws OperationCanceledException, CoreException { SubMonitor progress = SubMonitor.convert(monitor, 2); try { final Collection<IASTLiteralExpression> result = new <START> ArrayList<IASTLiteralExpression>(); <END> IASTTranslationUnit ast = getAST(tu, progress.newChild(1)); ast.accept(new ASTVisitor() { { shouldVisitExpressions = true; } @Override public int visit(IASTExpression expression) { if (expression instanceof IASTLiteralExpression) { if (!(expression.getNodeLocations().length == 1 && expression.getNodeLocations()[0] instanceof IASTMacroExpansionLocation)) { IASTLiteralExpression literal = (IASTLiteralExpression) expression; result.add(literal); } } return super.visit(expression); } }); return result; } finally { if (monitor != null) { monitor.done(); } } }</code><technical_language><> sufficient</technical_language>

Target:
private Collection<IASTLiteralExpression> findAllLiterals(IProgressMonitor monitor) throws OperationCanceledException, CoreException { SubMonitor subMonitor = SubMonitor.convert(monitor, 5); final Collection<IASTLiteralExpression> result = new ArrayList<>(); IASTTranslationUnit ast = getAST(tu, subMonitor.split(4)); ast.accept(new ASTVisitor() { { shouldVisitExpressions = true; } @Override public int visit(IASTExpression expression) { if (expression instanceof IASTLiteralExpression) { if (!(expression.getNodeLocations().length == 1 && expression.getNodeLocations()[0] instanceof IASTMacroExpansionLocation)) { IASTLiteralExpression literal = (IASTLiteralExpression) expression; result.add(literal); } } return super.visit(expression); } }); subMonitor.split(1); return result; }
Source:
<code>DbSchema(DbContents contents, String name, boolean isDefault) { this.contents = contents; this.name = name; this.quotedName = contents.quoteIdentifier(name); this.isDefault = isDefault; if (name == null) { isSystem = true; } else if ("INFORMATION_SCHEMA".equals(name)) { isSystem = true; } else if (!contents.isH2() && StringUtils.toUpperEnglish(name).startsWith("INFO")) { isSystem = true; } else if (contents.isPostgreSQL() && StringUtils.toUpperEnglish(name).startsWith("PG_")) { isSystem = true; } else <START> isSystem = contents.isDerby() && name.startsWith("SYS"); <END> }</code><technical_language>problem is this change case Derby "default" / "other" case. this condition is special treated conditions it. this is clear for casual reader. This reduces bytecode size instructions saves JIT compilation C2. Readability is more important this. if-else if-else operator reorganized avoid = true = false, proper line breaks indentation preserve readability. This reduces size of bytecode significantly. this is necessary this constructor is performance-critical</technical_language>

Target:
DbSchema(DbContents contents, String name, boolean isDefault) { this.contents = contents; this.name = name; this.quotedName = contents.quoteIdentifier(name); this.isDefault = isDefault; if (name == null) { isSystem = true; } else if ("INFORMATION_SCHEMA".equals(name)) { isSystem = true; } else if (!contents.isH2() && StringUtils.toUpperEnglish(name).startsWith("INFO")) { isSystem = true; } else if (contents.isPostgreSQL() && StringUtils.toUpperEnglish(name).startsWith("PG_")) { isSystem = true; } else if (contents.isDerby() && name.startsWith("SYS")) { isSystem = true; } else { isSystem = false; } }
Source:
<code>public StreamInputPacketIndexEntry(long dataOffsetBits, long fileSizeBytes) { fContentSizeBits = (fileSizeBytes * 8); fPacketSizeBits = (fileSizeBytes * 8); <START> fOffsetBytes = dataOffsetBits; <END> fLostEvents = 0; fTarget = ""; fTargetID = 0; fTimestampBegin = Long.MIN_VALUE; fTimestampEnd = Long.MAX_VALUE; }</code><technical_language>member variable Bytes in it, parameter Bits. Bytes, it</technical_language>

Target:
public StreamInputPacketIndexEntry(long dataOffsetBits, long fileSizeBytes) { fContentSizeBits = (fileSizeBytes * Byte.SIZE); fPacketSizeBits = (fileSizeBytes * Byte.SIZE); fOffsetBytes = (dataOffsetBits / Byte.SIZE); fLostEvents = 0; fTarget = ""; fTargetID = 0; fTimestampBegin = Long.MIN_VALUE; fTimestampEnd = Long.MAX_VALUE; }
Source:
<code><START> private String[] section(final Profile profile, final String... section) <END> throws IOException { final StringBuilder path = new StringBuilder(Tv.HUNDRED); for (final String element : section) { path.append(String.format("/entry[@key='%s']", element)); } path.append(""); final List<String> result = profile.read().xpath( String.format("/%s/item/text()", path.toString()) ); return result.toArray(new String[result.size()]); }</code><technical_language>@xupyprmv sections now</technical_language>

Target:
private static String[] section(final Profile profile, final String... section) throws IOException { final StringBuilder path = new StringBuilder(Tv.HUNDRED); for (final String element : section) { path.append(String.format("/entry[@key='%s']", element)); } final List<String> result = profile.read().xpath( String.format("/%s/item/text()", path.toString()) ); return result.toArray(new String[result.size()]); }
Source:
<code>public void testEmpty() { List<Object> response = client.execute( prepareGet().setUri(uriFor("/v1/person")).build(), createJsonResponseHandler(listCodec)); <START> assertEquals(response, Collections.emptyList()); <END> }</code><technical_language>ImmutableList.of()</technical_language>

Target:
public void testEmpty() { List<Object> response = client.execute( prepareGet().setUri(uriFor("/v1/person")).build(), createJsonResponseHandler(listCodec)); assertEquals(response, ImmutableList.of()); }
Source:
<code>public static OffsetDate of(LocalDate localDate, ZoneOffset zoneOffset) { <START> <END> final OffsetDate result = OffsetDate.newBuilder() .setDate(localDate) .setOffset(zoneOffset) .build(); return result; }</code><technical_language>Please remove empty line here</technical_language>

Target:
public static OffsetDate of(LocalDate localDate, ZoneOffset zoneOffset) { checkNotNull(localDate); checkNotNull(zoneOffset); final OffsetDate result = OffsetDate.newBuilder() .setDate(localDate) .setOffset(zoneOffset) .build(); return result; }
Source:
<code>public void parseArgs(ScriptEntry scriptEntry) throws InvalidArgumentsException { for (Argument arg : scriptEntry.getProcessedArgs()) { if (!scriptEntry.hasObject("mythicmob") && arg.matchesArgumentType(MythicMobsMobTag.class)) { scriptEntry.addObject("mythicmob", arg.asType(MythicMobsMobTag.class)); } else if (!scriptEntry.hasObject("operation") && arg.matchesEnum(Operation.values())) { scriptEntry.addObject("operation", arg.asElement()); } else if (!scriptEntry.hasObject("threat") && arg.matchesFloat()) { scriptEntry.addObject("threat", arg.asElement()); } else if (!scriptEntry.hasObject("targets") && arg.matchesPrefix("for") && arg.matchesArgumentList(EntityTag.class)) { scriptEntry.addObject("targets", arg.asType(ListTag.class).filter(EntityTag.class, scriptEntry)); } else { arg.reportUnhandled(); } } if (!scriptEntry.hasObject("mythicmob")) { throw new InvalidArgumentsException("Must specify a MythicMob"); } if (!scriptEntry.hasObject("operation")) { throw new InvalidArgumentsException("Must specify an Operation"); } if (!scriptEntry.hasObject("threat")) { <START> throw new InvalidArgumentsException("Must specify a threat value"); <END> } if (!scriptEntry.hasObject("targets")) { scriptEntry.defaultObject("targets", (Utilities.entryHasPlayer(scriptEntry) ? Arrays.asList(Utilities.getEntryPlayer(scriptEntry).getDenizenEntity()) : null)); } }</code><technical_language>Periods end of sentences in error messages</technical_language>

Target:
public void parseArgs(ScriptEntry scriptEntry) throws InvalidArgumentsException { for (Argument arg : scriptEntry.getProcessedArgs()) { if (!scriptEntry.hasObject("mythicmob") && arg.matchesArgumentType(MythicMobsMobTag.class)) { scriptEntry.addObject("mythicmob", arg.asType(MythicMobsMobTag.class)); } else if (!scriptEntry.hasObject("operation") && arg.matchesEnum(Operation.values())) { scriptEntry.addObject("operation", arg.asElement()); } else if (!scriptEntry.hasObject("threat") && arg.matchesFloat()) { scriptEntry.addObject("threat", arg.asElement()); } else if (!scriptEntry.hasObject("targets") && arg.matchesPrefix("for") && arg.matchesArgumentList(EntityTag.class)) { scriptEntry.addObject("targets", arg.asType(ListTag.class).filter(EntityTag.class, scriptEntry)); } else { arg.reportUnhandled(); } } if (!scriptEntry.hasObject("mythicmob")) { throw new InvalidArgumentsException("Must specify a MythicMob!"); } if (!scriptEntry.hasObject("operation")) { throw new InvalidArgumentsException("Must specify an Operation!"); } if (!scriptEntry.hasObject("threat")) { throw new InvalidArgumentsException("Must specify a threat value!"); } if (!scriptEntry.hasObject("targets")) { scriptEntry.defaultObject("targets", (Utilities.entryHasPlayer(scriptEntry) ? Arrays.asList(Utilities.getEntryPlayer(scriptEntry).getDenizenEntity()) : null)); } }
Source:
<code>default Optional<MessageId> rootMessage() { EventContext.OriginCase origin = getOriginCase(); switch (origin) { case PAST_MESSAGE: return Optional.of(getPastMessage().root()); case IMPORT_CONTEXT: <START> return Optional.empty(); <END> case EVENT_CONTEXT: case COMMAND_CONTEXT: case ORIGIN_NOT_SET: default: @SuppressWarnings("DuplicateStringLiteralInspection") MessageId id = MessageId .newBuilder() .setId(Identifier.pack(getRootCommandId())) .setTypeUrl("Unknown") .vBuild(); return Optional.of(id); } }</code><technical_language>I docs mention root event if event imported system, here, return empty for imported origins</technical_language>

Target:
default Optional<MessageId> rootMessage() { EventContext.OriginCase origin = getOriginCase(); switch (origin) { case PAST_MESSAGE: return Optional.of(getPastMessage().root()); case IMPORT_CONTEXT: return Optional.empty(); case EVENT_CONTEXT: case COMMAND_CONTEXT: case ORIGIN_NOT_SET: default: if (hasRootCommandId()) { @SuppressWarnings("DuplicateStringLiteralInspection") MessageId id = MessageId .newBuilder() .setId(Identifier.pack(getRootCommandId())) .setTypeUrl("Unknown") .vBuild(); return Optional.of(id); } else { _warn().log("Cannot determine root message ID."); return Optional.empty(); } } }
Source:
<code>public void edit(@Load Answer original, MarkedText description, String comment, List<Long> attachmentsIds) { AnswerInformation information = new AnswerInformation(description, currentUser, comment); brutalValidator.validate(information); validator.onErrorRedirectTo(this).answerEditForm(original); UpdateStatus status = original.updateWith(information); answers.save(original); List<Attachment> attachmentsLoaded = attachments.load(attachmentsIds); <START> original.removeAttachments(); <END> original.add(attachmentsLoaded); result.include("mamuteMessages", Arrays.asList(messageFactory.build("confirmation", status.getMessage()))); Question originalQuestion = original.getMainThread(); result.redirectTo(QuestionController.class).showQuestion(originalQuestion, originalQuestion.getSluggedTitle()); }</code><technical_language>Is a reason remove previous attachments</technical_language>

Target:
public void edit(@Load Answer original, MarkedText description, String comment, List<Long> attachmentsIds) { AnswerInformation information = new AnswerInformation(description, currentUser, comment); brutalValidator.validate(information); validator.onErrorRedirectTo(this).answerEditForm(original); UpdateStatus status = original.updateWith(information); answers.save(original); List<Attachment> attachmentsLoaded = attachments.load(attachmentsIds); original.replace(attachmentsLoaded); result.include("mamuteMessages", Arrays.asList(messageFactory.build("confirmation", status.getMessage()))); Question originalQuestion = original.getMainThread(); result.redirectTo(QuestionController.class).showQuestion(originalQuestion, originalQuestion.getSluggedTitle()); }
Source:
<code>private void addValueToLine(String key, List<String> columns, List<String> line, Object value) { if (!columns.contains(key)) { columns.add(key); } int position = columns.indexOf(key); if (line.size() < columns.size()) { for (int i = line.size(); i < columns.size(); i++) { line.add(null); } } if (value != null) { if (value instanceof Value) { Value val = (Value) value; if (val.hasType(InternalTypeSystem.TYPE_SYSTEM.LIST())) { value = val.asList(); } else if (val.hasType(InternalTypeSystem.TYPE_SYSTEM.MAP())) { value = val.asMap(); } } if (value instanceof Collection) { try { value = jsonMapper.writer().writeValueAsString(value); } catch (Exception ignored) { <START> logger.info(ignored.getMessage()); <END> } } } line.set(position, value == null ? null : value.toString()); }</code><technical_language>confusing log exception message (that is ignored)</technical_language>

Target:
private void addValueToLine(String key, List<String> columns, List<String> line, Object value) { if (!columns.contains(key)) { columns.add(key); } int position = columns.indexOf(key); if (line.size() < columns.size()) { for (int i = line.size(); i < columns.size(); i++) { line.add(null); } } if (value != null) { if (value instanceof Value) { Value val = (Value) value; if (val.hasType(InternalTypeSystem.TYPE_SYSTEM.LIST())) { value = val.asList(); } else if (val.hasType(InternalTypeSystem.TYPE_SYSTEM.MAP())) { value = val.asMap(); } } if (value instanceof Collection) { try { value = jsonMapper.writer().writeValueAsString(value); } catch (Exception e) { logger.debug("ignored exception: " + e.getMessage()); } } } line.set(position, value == null ? null : value.toString()); }
Source:
<code>public void onVideoCallScreenUiReady() { LogUtil.v("VideoCallPresenter.onVideoCallScreenUiReady", ""); Assert.checkState(!isVideoCallScreenUiReady); if (!CompatUtils.isVideoCompatible()) { return; } <START> isVideoCallScreenUiReady = true; <END> mDeviceOrientation = InCallOrientationEventListener.getCurrentOrientation(); InCallPresenter.getInstance().addListener(this); InCallPresenter.getInstance().addDetailsListener(this); InCallPresenter.getInstance().addIncomingCallListener(this); InCallPresenter.getInstance().addOrientationListener(this); InCallPresenter.getInstance().addInCallEventListener(this); InCallPresenter.getInstance().getLocalVideoSurfaceTexture().setDelegate(new LocalDelegate()); InCallPresenter.getInstance().getRemoteVideoSurfaceTexture().setDelegate(new RemoteDelegate()); InCallVideoCallCallbackNotifier.getInstance().addSurfaceChangeListener(this); mCurrentVideoState = VideoProfile.STATE_AUDIO_ONLY; mCurrentCallState = DialerCall.State.INVALID; InCallPresenter.InCallState inCallState = InCallPresenter.getInstance().getInCallState(); onStateChange(inCallState, inCallState, CallList.getInstance()); }</code><technical_language>Move this onStateChange</technical_language>

Target:
public void onVideoCallScreenUiReady() { LogUtil.v("VideoCallPresenter.onVideoCallScreenUiReady", ""); Assert.checkState(!isVideoCallScreenUiReady); if (!CompatUtils.isVideoCompatible()) { return; } mDeviceOrientation = InCallOrientationEventListener.getCurrentOrientation(); InCallPresenter.getInstance().addListener(this); InCallPresenter.getInstance().addDetailsListener(this); InCallPresenter.getInstance().addIncomingCallListener(this); InCallPresenter.getInstance().addOrientationListener(this); InCallPresenter.getInstance().addInCallEventListener(this); InCallPresenter.getInstance().getLocalVideoSurfaceTexture().setDelegate(new LocalDelegate()); InCallPresenter.getInstance().getRemoteVideoSurfaceTexture().setDelegate(new RemoteDelegate()); InCallVideoCallCallbackNotifier.getInstance().addSurfaceChangeListener(this); mCurrentVideoState = VideoProfile.STATE_AUDIO_ONLY; mCurrentCallState = DialerCall.State.INVALID; isVideoCallScreenUiReady = true; InCallPresenter.InCallState inCallState = InCallPresenter.getInstance().getInCallState(); onStateChange(inCallState, inCallState, CallList.getInstance()); }
Source:
<code>public void testTemplateMatch() throws Exception { ImmutableMap<HttpRequest, HttpResponse> requestResponseMap = ImmutableMap. <HttpRequest, HttpResponse>builder() .put(requestForScopes(COMPUTE_READONLY_SCOPE), TOKEN_RESPONSE) .put(GET_PROJECT_REQUEST, GET_PROJECT_RESPONSE) .put(LIST_ZONES_REQ, LIST_ZONES_RESPONSE) .put(LIST_PROJECT_IMAGES_REQUEST, LIST_PROJECT_IMAGES_RESPONSE) .put(LIST_GOOGLE_IMAGES_REQUEST, LIST_GOOGLE_IMAGES_RESPONSE) .put(LIST_MACHINE_TYPES_REQUEST, LIST_MACHINE_TYPES_RESPONSE) .put(LIST_CENTRAL1B_MACHINE_TYPES_REQUEST, LIST_CENTRAL1B_MACHINE_TYPES_RESPONSE) .build(); ComputeService client = requestsSendResponses(requestResponseMap); Template template = client.templateBuilder().build(); Hardware defaultSize = client.templateBuilder().build().getHardware(); Hardware smallest = client.templateBuilder().smallest().build().getHardware(); assertEquals(defaultSize, smallest); Hardware fastest = client.templateBuilder().fastest().build().getHardware(); <START> assertNotNull(fastest); <END> assertEquals(client.listHardwareProfiles().size(), 4); Template toMatch = client.templateBuilder() .imageId(template.getImage().getId()) .build(); assertEquals(toMatch.getImage(), template.getImage()); }</code><technical_language>other checks fastest</technical_language>

Target:
public void testTemplateMatch() throws Exception { ImmutableMap<HttpRequest, HttpResponse> requestResponseMap = ImmutableMap. <HttpRequest, HttpResponse>builder() .put(requestForScopes(COMPUTE_READONLY_SCOPE), TOKEN_RESPONSE) .put(GET_PROJECT_REQUEST, GET_PROJECT_RESPONSE) .put(LIST_ZONES_REQ, LIST_ZONES_RESPONSE) .put(LIST_PROJECT_IMAGES_REQUEST, LIST_PROJECT_IMAGES_RESPONSE) .put(LIST_GOOGLE_IMAGES_REQUEST, LIST_GOOGLE_IMAGES_RESPONSE) .put(LIST_MACHINE_TYPES_REQUEST, LIST_MACHINE_TYPES_RESPONSE) .put(LIST_CENTRAL1B_MACHINE_TYPES_REQUEST, LIST_CENTRAL1B_MACHINE_TYPES_RESPONSE) .build(); ComputeService client = requestsSendResponses(requestResponseMap); Template template = client.templateBuilder().build(); Hardware defaultSize = client.templateBuilder().build().getHardware(); Hardware smallest = client.templateBuilder().smallest().build().getHardware(); assertEquals(defaultSize, smallest); Hardware fastest = client.templateBuilder().fastest().build().getHardware(); assertNotNull(fastest); assertEquals(client.listHardwareProfiles().size(), 5); Template toMatch = client.templateBuilder() .imageId(template.getImage().getId()) .build(); assertEquals(toMatch.getImage(), template.getImage()); }
Source:
<code>private String correctEmojiFormat(String iconEmoji) { if(StringUtils.isEmpty(iconEmoji)) { return iconEmoji; } <START> else if (!iconEmoji.startsWith(":")) { <END> iconEmoji = ":" + iconEmoji; } if (!iconEmoji.endsWith(":")) { iconEmoji = iconEmoji + ":"; } return iconEmoji; }</code><technical_language>shorten this suggestion iconEmoji = StringUtils.appendIfMissing(iconEmoji, ":")</technical_language>

Target:
private String correctEmojiFormat(String iconEmoji) { if (StringUtils.isEmpty(iconEmoji)) { return iconEmoji; } iconEmoji = StringUtils.appendIfMissing(iconEmoji, ":"); iconEmoji = StringUtils.prependIfMissing(iconEmoji, ":"); return iconEmoji; }
Source:
<code>private RepositoryArtifactProvider createRemoteArtifactProvider(Set<MavenRepositoryLocation> completeRepositories, List<TargetDefinitionContent> targetDefinitionsContent) { List<URI> allRemoteArtifactRepositories = new ArrayList<URI>(); for (MavenRepositoryLocation location : completeRepositories) { if (!offline || URIUtil.isFileURI(location.getURL())) { allRemoteArtifactRepositories.add(location.getURL()); } } for (TargetDefinitionContent targetDefinitionContent : targetDefinitionsContent) { allRemoteArtifactRepositories.addAll(targetDefinitionContent.getArtifactRepositoryLocations()); } IProgressMonitor <START> monitor = <END> new DuplicateFilteringLoggingProgressMonitor(logger); RepositoryArtifactProvider provider = new RepositoryArtifactProvider(allRemoteArtifactRepositories, ArtifactTransferPolicies.forRemoteArtifacts(), remoteAgent, monitor); return provider; }</code><technical_language>is a monitor field in this class is a DuplicateFilteringLoggingProgressMonitor (see line #95). is need create another instance - right</technical_language>

Target:
private RepositoryArtifactProvider createRemoteArtifactProvider(Set<MavenRepositoryLocation> completeRepositories, List<TargetDefinitionContent> targetDefinitionsContent) { List<URI> allRemoteArtifactRepositories = new ArrayList<URI>(); for (MavenRepositoryLocation location : completeRepositories) { if (!offline || URIUtil.isFileURI(location.getURL())) { allRemoteArtifactRepositories.add(location.getURL()); } } for (TargetDefinitionContent targetDefinitionContent : targetDefinitionsContent) { allRemoteArtifactRepositories.addAll(targetDefinitionContent.getArtifactRepositoryLocations()); } return new RepositoryArtifactProvider(allRemoteArtifactRepositories, ArtifactTransferPolicies.forRemoteArtifacts(), remoteAgent, monitor); }
Source:
<code>private static SwitchingBackend createForwardingBackend(ComponentRegistry componentRegistry, String indexName, LocalBackendFactory localBackendFactory, CacheManagerService cacheManagerService, DirectoryBasedIndexManager indexManager) { RpcManager rpcManager = componentRegistry.getComponent(RpcManager.class); <START> if (rpcManager==null) { <END> LocalonlyBackend backend = new LocalonlyBackend(localBackendFactory); backend.initialize(); return backend; } else { EmbeddedCacheManager embeddedCacheManager = cacheManagerService.getEmbeddedCacheManager(); TransactionManager transactionManager = componentRegistry.getComponent(TransactionManager.class); IndexLockController lockControl = new IndexManagerBasedLockController(indexManager, transactionManager); ClusteredSwitchingBackend backend = new ClusteredSwitchingBackend(componentRegistry, indexName, localBackendFactory, lockControl); backend.initialize(); embeddedCacheManager.addListener(backend); return backend; } }</code><technical_language>noes, space :)</technical_language>

Target:
private static SwitchingBackend createForwardingBackend(ComponentRegistry componentRegistry, String indexName, LocalBackendFactory localBackendFactory, CacheManagerService cacheManagerService, DirectoryBasedIndexManager indexManager) { RpcManager rpcManager = componentRegistry.getComponent(RpcManager.class); if (rpcManager == null) { LocalOnlyBackend backend = new LocalOnlyBackend(localBackendFactory); backend.initialize(); return backend; } else { EmbeddedCacheManager embeddedCacheManager = cacheManagerService.getEmbeddedCacheManager(); TransactionManager transactionManager = componentRegistry.getComponent(TransactionManager.class); IndexLockController lockControl = new IndexManagerBasedLockController(indexManager, transactionManager); ClusteredSwitchingBackend backend = new ClusteredSwitchingBackend(componentRegistry, indexName, localBackendFactory, lockControl); backend.initialize(); embeddedCacheManager.addListener(backend); return backend; } }
Source:
<code>private void registerJava8TimeConversions() { if ( !isJava8TimeAvailable() ) { return; } register( JavaTimeConstants.ZONED_DATE_TIME_FQN, String.class, new JavaZonedDateTimeToStringConversion() ); register( JavaTimeConstants.LOCAL_DATE_FQN, String.class, new JavaLocalDateToStringConversion() ); register( JavaTimeConstants.LOCAL_DATE_TIME_FQN, String.class, new JavaLocalDateTimeToStringConversion() ); register( JavaTimeConstants.LOCAL_TIME_FQN, String.class, new JavaLocalTimeToStringConversion() ); register( JavaTimeConstants.ZONED_DATE_TIME_FQN, Date.class, new JavaZonedDateTimeToDateConversion() ); register( JavaTimeConstants.LOCAL_DATE_TIME_FQN, Date.class, new JavaLocalDateTimeToDateConversion() ); register( JavaTimeConstants.LOCAL_DATE_FQN, Date.class, new JavaLocalDateToDateConversion() ); <START> register( java.sql.Date.class, JavaTimeConstants.LOCAL_DATE_FQN, new JavaSqlDateToLocalDateConversion() ); <END> register( JavaTimeConstants.INSTANT, Date.class, new JavaInstantToDateConversion() ); }</code><technical_language>do reverser registration (first LOCAL_DATE_FQN java.sql.Date)? need new register method. name of conversion need JavaLocalDateToSqlDateConversion</technical_language>

Target:
private void registerJava8TimeConversions() { if ( !isJava8TimeAvailable() ) { return; } register( JavaTimeConstants.ZONED_DATE_TIME_FQN, String.class, new JavaZonedDateTimeToStringConversion() ); register( JavaTimeConstants.LOCAL_DATE_FQN, String.class, new JavaLocalDateToStringConversion() ); register( JavaTimeConstants.LOCAL_DATE_TIME_FQN, String.class, new JavaLocalDateTimeToStringConversion() ); register( JavaTimeConstants.LOCAL_TIME_FQN, String.class, new JavaLocalTimeToStringConversion() ); register( JavaTimeConstants.ZONED_DATE_TIME_FQN, Date.class, new JavaZonedDateTimeToDateConversion() ); register( JavaTimeConstants.LOCAL_DATE_TIME_FQN, Date.class, new JavaLocalDateTimeToDateConversion() ); register( JavaTimeConstants.LOCAL_DATE_FQN, Date.class, new JavaLocalDateToDateConversion() ); register( JavaTimeConstants.LOCAL_DATE_FQN, java.sql.Date.class, new JavaLocalDateToSqlDateConversion() ); register( JavaTimeConstants.INSTANT, Date.class, new JavaInstantToDateConversion() ); }
Source:
<code>public boolean regenerate(Region region, EditSession editSession) { try { Server server = Sponge.getServer(); WorldProperties tempWorldProperties; try { tempWorldProperties = server.createWorldProperties("worldedittemp", this.regenerationArchetype); } catch (IOException e) { <START> e.printStackTrace(); <END> return false; } Optional<World> tempWorldOpt = server.loadWorld(tempWorldProperties); if (!tempWorldOpt.isPresent()) { return false; } World freshWorld = tempWorldOpt.get(); CuboidRegion expandedPreGen = new CuboidRegion(region.getMinimumPoint().subtract(16, 0, 16), region.getMaximumPoint().add(16, 0, 16)); for (Vector2D chunk : expandedPreGen.getChunks()) { freshWorld.getChunk(chunk.getBlockX(), 0, chunk.getBlockZ()); } SpongeWorld from = SpongeWorldEdit.inst().getWorld(freshWorld); for (BlockVector vec : region) { editSession.setBlock(vec, from.getBlock(vec)); } server.unloadWorld(freshWorld); server.deleteWorld(tempWorldProperties); } catch (MaxChangedBlocksException e) { throw new RuntimeException(e); } return false; }</code><technical_language>I add a logger (SLF4J) this class, log exception way</technical_language>

Target:
public boolean regenerate(Region region, EditSession editSession) { Server server = Sponge.getServer(); final String id = "regenArchetype" + getWorld().getName(); final WorldArchetype regenerationArchetype = Sponge.getRegistry().getType(WorldArchetype.class, id) .orElseGet(() -> WorldArchetype.builder() .from(getWorld().getProperties()) .serializationBehavior(SerializationBehaviors.NONE) .build(id, id)); WorldProperties tempWorldProperties; try { tempWorldProperties = server.createWorldProperties("worldedittemp", regenerationArchetype); tempWorldProperties.setGenerateSpawnOnLoad(false); } catch (IOException e) { log.error("Error creating world properties", e); return false; } Optional<World> tempWorldOpt = server.loadWorld(tempWorldProperties); if (!tempWorldOpt.isPresent()) { log.error("Failed to load temp world"); return false; } World freshWorld = tempWorldOpt.get(); try { CuboidRegion expandedPreGen = new CuboidRegion(region.getMinimumPoint().subtract(16, 0, 16), region.getMaximumPoint().add(16, 0, 16)); for (Vector2D chunk : expandedPreGen.getChunks()) { freshWorld.getChunk(chunk.getBlockX(), 0, chunk.getBlockZ()); } SpongeWorld from = SpongeWorldEdit.inst().getWorld(freshWorld); for (BlockVector vec : region) { editSession.setBlock(vec, from.getBlock(vec)); } } catch (MaxChangedBlocksException e) { throw new RuntimeException(e); } finally { server.unloadWorld(freshWorld); server.deleteWorld(tempWorldProperties); } return false; }
Source:
<code>public void testWindowsMachines(String osFamily) throws Exception { brooklynProperties.put("brooklyn.location.byon.user", "myuser"); brooklynProperties.put("brooklyn.location.byon.password", "mypassword"); String spec = "byon"; Map<String, ?> flags = ImmutableMap.of( "hosts", ImmutableList.of("1.1.1.1", "2.2.2.2"), <START> "osFamily", "windows" <END> ); MachineProvisioningLocation<MachineLocation> provisioner = resolve(spec, flags); WinRmMachineLocation location = (WinRmMachineLocation) provisioner.obtain(ImmutableMap.of()); assertEquals(location.config().get(WinRmMachineLocation.USER), "myuser"); assertEquals(location.config().get(WinRmMachineLocation.PASSWORD), "mypassword"); assertEquals(location.config().get(WinRmMachineLocation.ADDRESS).getHostAddress(), "1.1.1.1"); }</code><technical_language>This reverts Sam's change (where tested is case insensitive). revert osFamily parameter please</technical_language>

Target:
public void testWindowsMachines(String osFamily) throws Exception { brooklynProperties.put("brooklyn.location.byon.user", "myuser"); brooklynProperties.put("brooklyn.location.byon.password", "mypassword"); String spec = "byon"; Map<String, ?> flags = ImmutableMap.of( "hosts", ImmutableList.of("1.1.1.1", "2.2.2.2"), "osFamily", osFamily ); MachineProvisioningLocation<MachineLocation> provisioner = resolve(spec, flags); WinRmMachineLocation location = (WinRmMachineLocation) provisioner.obtain(ImmutableMap.of()); assertEquals(location.config().get(WinRmMachineLocation.USER), "myuser"); assertEquals(location.config().get(WinRmMachineLocation.PASSWORD), "mypassword"); assertEquals(location.config().get(WinRmMachineLocation.ADDRESS).getHostAddress(), "1.1.1.1"); }
Source:
<code>protected Method getGetterMethod(SystemResource sr) { try { return operatingSystemMXBean.getClass().getMethod("get" + sr.name(), null); } catch (Exception e) { <START> throw new RuntimeException("Invalid SystemResource: " + sr); <END> } }</code><technical_language>Throwables.propagate please other places a new RuntimeException</technical_language>

Target:
private Method getGetterMethod(SystemResource sr) { try { return operatingSystemMXBean.getClass().getMethod("get" + sr.name(), null); } catch (Exception e) { throw Throwables.propagate(e); } }
Source:
<code>private <T> List<T> nullToEmpty(List<T> list) { if (list == null) { return Collections.emptyList(); <START> } else { <END> return new ArrayList<>(list); } }</code><technical_language>please remove else, code more readable</technical_language>

Target:
private <T> List<T> nullToEmpty(List<T> list) { if (list == null) { return Collections.emptyList(); } return new ArrayList<>(list); }
Source:
<code>public AbstractRepositoryRestController(PagedResourcesAssembler<Object> assembler, PersistentEntityResourceAssembler<Object> entityResourceAssembler) { <START> System.out.println("Registering " + this.getClass() + " controller..."); <END> this.assembler = assembler; this.perAssembler = entityResourceAssembler; }</code><technical_language>Remove merging</technical_language>

Target:
public AbstractRepositoryRestController(PagedResourcesAssembler<Object> assembler, PersistentEntityResourceAssembler<Object> entityResourceAssembler) { this.assembler = assembler; this.perAssembler = entityResourceAssembler; }
Source:
<code>public Optional<MethodSpec> generate() { TypeVariableName settableT = TypeVariableName.get("SettableT"); settableT = settableT.withBounds( ParameterizedTypeName.get(ClassName.get(SettableByName.class), settableT)); TypeName nullSavingStrategyT = TypeVariableName.get(NullSavingStrategy.class); MethodSpec.Builder injectBuilder = MethodSpec.methodBuilder("set") .addAnnotation(Override.class) .addModifiers(Modifier.PUBLIC) .addTypeVariable(settableT) .addParameter(ParameterSpec.builder(entityDefinition.getClassName(), "entity").build()) .addParameter(ParameterSpec.builder(settableT, "target").build()) <START> .addParameter(ParameterSpec.builder(nullSavingStrategyT, "nullSavingStrategy").build()) <END> .returns(settableT); for (PropertyDefinition property : entityDefinition.getAllColumns()) { GeneratedCodePatterns.setValue( property.getCqlName(), property.getType(), CodeBlock.of("entity.$L()", property.getGetterName()), "target", injectBuilder, enclosingClass, CodeBlock.of("nullSavingStrategy")); } injectBuilder.addCode("\n").addStatement("return target"); return Optional.of(injectBuilder.build()); }</code><technical_language>need explicitly build a type name, builder accepts a simple class: suggestion .addParameter(ParameterSpec.builder(NullSavingStrategy.class, "nullSavingStrategy").build()) (I for SettableT more complex)</technical_language>

Target:
public Optional<MethodSpec> generate() { TypeVariableName settableT = TypeVariableName.get("SettableT"); settableT = settableT.withBounds( ParameterizedTypeName.get(ClassName.get(SettableByName.class), settableT)); MethodSpec.Builder injectBuilder = MethodSpec.methodBuilder("set") .addAnnotation(Override.class) .addModifiers(Modifier.PUBLIC) .addTypeVariable(settableT) .addParameter(ParameterSpec.builder(entityDefinition.getClassName(), "entity").build()) .addParameter(ParameterSpec.builder(settableT, "target").build()) .addParameter( ParameterSpec.builder(NullSavingStrategy.class, "nullSavingStrategy").build()) .returns(settableT); for (PropertyDefinition property : entityDefinition.getAllColumns()) { GeneratedCodePatterns.setValue( property.getCqlName(), property.getType(), CodeBlock.of("entity.$L()", property.getGetterName()), "target", injectBuilder, enclosingClass, true); } injectBuilder.addCode("\n").addStatement("return target"); return Optional.of(injectBuilder.build()); }