auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>private static String buildErrorMessage(KafkaTopic topic, int partition, long offset, String message) { <START> return message + format("[offset %d, kafka_topic %s, partition %d]", <END> offset, topic.name().asString(), partition); }</code><technical_language>format("%s [offset %d, kafka_topic %s, partition %d]", message, offset, topic.name().asString(), partition); WDYT</technical_language>

Target:
private static String buildErrorMessage(KafkaTopic topic, int partition, long offset, String message) { return format("%s [offset %d, kafka_topic %s, partition %d]", message, offset, topic.name().asString(), partition); }
Source:
<code>public FileReceiver( TransmissionMeta meta, int chunkSize, BooleanSupplier stopChecker, FileIOFactory factory, Consumer<File> hnd, String path, IgniteLogger log ) { super(meta, stopChecker, log, chunkSize); A.notNull(hnd, "FileHandler must be provided by transmission handler"); A.notNull(path, "File absolute path cannot be null"); A.ensure(!path.trim().isEmpty(), "File absolute path cannot be empty "); this.hnd = hnd; file = new File(path); try { fileIo = factory.create(file); fileIo.position(meta.offset()); } catch (IOException e) { <START> throw new IgniteException("Unable to open destination file. Receiver will will be stopped: " + <END> file.getAbsolutePath(), e); } }</code><technical_language>></technical_language>

Target:
public FileReceiver( TransmissionMeta meta, int chunkSize, BooleanSupplier stopChecker, FileIOFactory factory, Consumer<File> hnd, String path, IgniteLogger log ) { super(meta, stopChecker, log, chunkSize); A.notNull(hnd, "FileHandler must be provided by transmission handler"); A.notNull(path, "File absolute path cannot be null"); A.ensure(!path.trim().isEmpty(), "File absolute path cannot be empty "); this.hnd = hnd; file = new File(path); try { fileIo = factory.create(file); fileIo.position(meta.offset()); } catch (IOException e) { throw new IgniteException("Unable to open destination file. Receiver will be stopped: " + file.getAbsolutePath(), e); } }
Source:
<code>public long getLatencyAtPercentile(Host host, Statement statement, Exception exception, double percentile) { <START> checkArgument(percentile >= 0.0 && percentile < 100, <END> "percentile must be between 0.0 and 100 (was %f)"); Histogram histogram = getLastIntervalHistogram(host, statement, exception); if (histogram == null || histogram.getTotalCount() < minRecordedValues) return -1; return histogram.getValueAtPercentile(percentile); }</code><technical_language>This fill in percentile value, logs %f</technical_language>

Target:
public long getLatencyAtPercentile(Host host, Statement statement, Exception exception, double percentile) { checkArgument(percentile >= 0.0 && percentile < 100, "percentile must be between 0.0 and 100 (was %s)", percentile); Histogram histogram = getLastIntervalHistogram(host, statement, exception); if (histogram == null || histogram.getTotalCount() < minRecordedValues) return -1; return histogram.getValueAtPercentile(percentile); }
Source:
<code>private void initModList() { modListView.getSelectionModel().setSelectionMode(SelectionMode.MULTIPLE); modListView.setCellFactory(modListCellFactory()); modListView.getItems().setAll(modService.getInstalledMods()); try { modService.getActivatedSimAndUIMods().forEach(mod -> modListView.getSelectionModel().select(mod)); } catch (IOException e) { <START> logger.error("Activated Mods could not be loaded", e); <END> } modListView.scrollTo(modListView.getSelectionModel().getSelectedItem()); }</code><technical_language>mods</technical_language>

Target:
private void initModList() { modListView.getSelectionModel().setSelectionMode(SelectionMode.MULTIPLE); modListView.setCellFactory(modListCellFactory()); modListView.getItems().setAll(modService.getInstalledMods()); try { modService.getActivatedSimAndUIMods().forEach(mod -> modListView.getSelectionModel().select(mod)); } catch (IOException e) { logger.error("Activated mods could not be loaded", e); } modListView.scrollTo(modListView.getSelectionModel().getSelectedItem()); }
Source:
<code><START> private Adapter buildAdapter(org.opennms.netmgt.telemetry.config.model.Adapter adapterDef) throws Exception { <END> AdapterFactory adapterFactory = null; while (ManagementFactory.getRuntimeMXBean().getUptime() < GRACE_PERIOD_MS) { try { Thread.sleep(LOOKUP_DELAY_MS); } catch (InterruptedException e) { LOG.error( "Interrupted while waiting for adapter factory to become available in the service registry. Aborting."); return null; } adapterFactory = adapterRegistry.getAdapterFactoryByClassName(adapterDef.getClassName()); if (adapterFactory != null) { break; } } final Adapter adapter; if (adapterFactory != null) { adapter = adapterFactory.createAdapter(protocolDef, adapterDef.getParameterMap()); } else { final Object adapterInstance; try { final Class<?> clazz = Class.forName(adapterDef.getClassName()); final Constructor<?> ctor = clazz.getConstructor(); adapterInstance = ctor.newInstance(); } catch (Exception e) { throw new RuntimeException(String.format("Failed to instantiate adapter with class name '%s'.", adapterDef.getClassName(), e)); } if (!(adapterInstance instanceof Adapter)) { throw new IllegalArgumentException(String.format("%s must implement %s", adapterDef.getClassName(), Adapter.class.getCanonicalName())); } adapter = (Adapter) adapterInstance; final BeanWrapper wrapper = PropertyAccessorFactory.forBeanPropertyAccess(adapter); wrapper.setPropertyValues(adapterDef.getParameterMap()); final AutowireCapableBeanFactory beanFactory = applicationContext.getAutowireCapableBeanFactory(); beanFactory.autowireBean(adapter); beanFactory.initializeBean(adapter, "adapter"); adapter.setProtocol(protocolDef); } return adapter; }</code><technical_language>I move logic constructing adapter registry instead of here</technical_language>

Target:
private Adapter buildAdapter(org.opennms.netmgt.telemetry.config.model.Adapter adapterDef) throws Exception { Adapter adapter = adapterRegistry.getAdapter(adapterDef.getClassName(), protocolDef, adapterDef.getParameterMap()); if (adapter == null) { final Object adapterInstance; try { final Class<?> clazz = Class.forName(adapterDef.getClassName()); final Constructor<?> ctor = clazz.getConstructor(); adapterInstance = ctor.newInstance(); } catch (Exception e) { throw new RuntimeException(String.format("Failed to instantiate adapter with class name '%s'.", adapterDef.getClassName(), e)); } if (!(adapterInstance instanceof Adapter)) { throw new IllegalArgumentException(String.format("%s must implement %s", adapterDef.getClassName(), Adapter.class.getCanonicalName())); } adapter = (Adapter) adapterInstance; final BeanWrapper wrapper = PropertyAccessorFactory.forBeanPropertyAccess(adapter); wrapper.setPropertyValues(adapterDef.getParameterMap()); final AutowireCapableBeanFactory beanFactory = applicationContext.getAutowireCapableBeanFactory(); beanFactory.autowireBean(adapter); beanFactory.initializeBean(adapter, "adapter"); adapter.setProtocol(protocolDef); } return adapter; }
Source:
<code><START> protected Resource[] createResources() { <END> final Resource drlResource = KieServices.Factory.get().getResources().newReaderResource(new StringReader(DRL)); drlResource.setTargetPath(TestConstants.DRL_TEST_TARGET_PATH); return new Resource[] { drlResource }; }</code><technical_language>This method put parent class called in test class. some ResourcesUtil class created handling resources. KieUtil used</technical_language>

Target:
protected Resource[] createResources() { return KieUtil.createResources(DRL); }
Source:
<code>public final int doPhase2Commit () { if (jtsLogger.logger.isTraceEnabled()) { jtsLogger.logger.trace("ServerTransaction::doPhase2Commit ( " + get_uid() + " )"); } org.omg.CosTransactions.Status s = get_status(); <START> if (s != org.omg.CosTransactions.Status.StatusPrepared && s != org.omg.CosTransactions.Status.StatusCommitted) { <END> jtsLogger.i18NLogger.warn_orbspecific_interposition_coordinator_txnotprepared("ServerTransaction.doPhase2Commit", Utility.stringStatus(s)); return finalStatus(); } super.phase2Commit(true); if (super.failedList != null && super.failedList.size() > 0) { return ActionStatus.COMMITTING; } try { doAfterCompletion(get_status()); } catch (Exception e) { } if (parentTransaction != null) parentTransaction.removeChildAction(this); super.destroyAction(); ActionManager.manager().remove(get_uid()); return finalStatus(); }</code><technical_language>this change if status == org.omg.CosTransactions.Status.StatusCommitted code skip this if call super.phase2Commit(true); line 243 instead. this is intended (ie call commit a committed transaction)</technical_language>

Target:
public final int doPhase2Commit () { if (jtsLogger.logger.isTraceEnabled()) { jtsLogger.logger.trace("ServerTransaction::doPhase2Commit ( " + get_uid() + " )"); } org.omg.CosTransactions.Status s = get_status(); if (s != org.omg.CosTransactions.Status.StatusPrepared) { jtsLogger.i18NLogger.warn_orbspecific_interposition_coordinator_txnotprepared("ServerTransaction.doPhase2Commit", Utility.stringStatus(s)); return finalStatus(); } super.phase2Commit(true); if (super.failedList != null && super.failedList.size() > 0) { return ActionStatus.COMMITTING; } try { doAfterCompletion(get_status()); } catch (Exception e) { } if (parentTransaction != null) parentTransaction.removeChildAction(this); super.destroyAction(); ActionManager.manager().remove(get_uid()); return finalStatus(); }
Source:
<code>public BufferedMutator getBufferedMutator(BufferedMutatorParams params) throws IOException { if (params.getTableName() == null) { throw new IllegalArgumentException("TableName cannot be null."); } if (params.getPool() == null) { params.pool(getBatchPool()); } if (params.getWriteBufferSize() == BufferedMutatorParams.UNSET) { if (conf.getRaw(TableConfiguration.WRITE_BUFFER_SIZE_KEY) == null){ params.writeBufferSize(tableConfig.getWriteBufferSize() * 4); } else { params.writeBufferSize(tableConfig.getWriteBufferSize()); } } <START> int maxInflightRpcs = conf.getInt(MAX_INFLIGHT_RPCS, getMaxThreads()); <END> return new BigtableBufferedMutator(conf, params.getTableName(), maxInflightRpcs, params.getWriteBufferSize(), client, options, params.getPool(), params.getListener()); }</code><technical_language>Inflight RPCs max threads (I think) completely disconnected other</technical_language>

Target:
public BufferedMutator getBufferedMutator(BufferedMutatorParams params) throws IOException { if (params.getTableName() == null) { throw new IllegalArgumentException("TableName cannot be null."); } if (params.getPool() == null) { params.pool(getBatchPool()); } if (params.getWriteBufferSize() == BufferedMutatorParams.UNSET) { params.writeBufferSize(tableConfig.getWriteBufferSize()); } int defaultRpcCount = MAX_INFLIGHT_RPCS_DEFAULT * options.getChannelCount(); int maxInflightRpcs = conf.getInt(MAX_INFLIGHT_RPCS_KEY, defaultRpcCount); return new BigtableBufferedMutator(conf, params.getTableName(), maxInflightRpcs, params.getWriteBufferSize(), client, options, params.getPool(), params.getListener()); }
Source:
<code>protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.recycler_view_demo); mSendButton = (Button) findViewById(R.id.sendButton); mMessageEdit = (EditText) findViewById(R.id.messageEdit); mRef = new Firebase("<LINK_0>"); mChatRef = mRef.limitToLast(50); mSendButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Chat chat = new Chat(name, mAuthData.getUid(), mMessageEdit.getText().toString()); mRef.push().setValue(chat, new Firebase.CompletionListener() { @Override public void onComplete(FirebaseError firebaseError, Firebase firebase) { if (firebaseError != null) { Log.e(TAG, firebaseError.toString()); } } }); mMessageEdit.setText(""); } }); mMessages = (RecyclerView) findViewById(R.id.messagesList); LinearLayoutManager manager = new LinearLayoutManager(this); manager.setReverseLayout(false); mMessages.setHasFixedSize(false); mMessages.setLayoutManager(manager); mRecycleViewAdapter = new FirebaseRecyclerViewAdapter<Chat, ChatHolder>(Chat.class, R.layout.message, ChatHolder.class, mChatRef) { @Override public void populateViewHolder(ChatHolder chatView, Chat chat) { chatView.setName(chat.getName()); chatView.setText(chat.getText()); <START> if (mAuthData != null && chat.getUid().equals(mAuthData.getUid())) { <END> chatView.setIsSender(true); } else { chatView.setIsSender(false); } } }; mMessages.setAdapter(mRecycleViewAdapter); }</code><technical_language>pretty chats out a uid. this work them? If not, worth extra null check chat.getUid()</technical_language>

Target:
protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.recycler_view_demo); mSendButton = (Button) findViewById(R.id.sendButton); mMessageEdit = (EditText) findViewById(R.id.messageEdit); mSendButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { showFirebaseLoginPrompt(); } }); mRef = new Firebase("<LINK_0>"); mChatRef = mRef.limitToLast(50); mSendButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Chat chat = new Chat(name, mAuthData.getUid(), mMessageEdit.getText().toString()); mRef.push().setValue(chat, new Firebase.CompletionListener() { @Override public void onComplete(FirebaseError firebaseError, Firebase firebase) { if (firebaseError != null) { Log.e(TAG, firebaseError.toString()); } } }); mMessageEdit.setText(""); } }); mMessages = (RecyclerView) findViewById(R.id.messagesList); LinearLayoutManager manager = new LinearLayoutManager(this); manager.setReverseLayout(false); mMessages.setHasFixedSize(false); mMessages.setLayoutManager(manager); mRecycleViewAdapter = new FirebaseRecyclerAdapter<Chat, ChatHolder>(Chat.class, R.layout.message, ChatHolder.class, mChatRef) { @Override public void populateViewHolder(ChatHolder chatView, Chat chat) { chatView.setName(chat.getName()); chatView.setText(chat.getText()); if (mAuthData != null && chat.getUid().equals(mAuthData.getUid())) { chatView.setIsSender(true); } else { chatView.setIsSender(false); } } }; mMessages.setAdapter(mRecycleViewAdapter); }
Source:
<code><START> protected void setBondingOptions(ListModel<Map.Entry<String, EntityModel<String>>> value) { <END> privateBondingOptions = value; }</code><technical_language>change modifier? If want change list of bondingOptions, is enough do- 'getBondingOptions().setItems(newBondingOptions)'</technical_language>

Target:
private void setBondingOptions(ListModel<Map.Entry<String, EntityModel<String>>> value) { privateBondingOptions = value; }
Source:
<code>public FileBody(File file, long regionSeek, long regionLength) throws IOException { this.file = new RandomAccessFile(file, "r"); channel = this.file.getChannel(); length = regionLength; if (regionSeek > 0) { <START> regionBase = regionSeek; <END> } }</code><technical_language>this is wrong</technical_language>

Target:
public FileBody(File file, long regionSeek, long regionLength) throws IOException { this.file = new RandomAccessFile(file, "r"); channel = this.file.getChannel(); length = regionLength; if (regionSeek > 0) { regionBase = regionSeek; } else { regionBase = 0L; } }
Source:
<code>public Pair<List<Guid>, Guid> runBalance(String balanceName, List<Guid> hostIDs, Map<String, String> propertiesMap) { try { XmlRpcClient client = new XmlRpcClient(); client.setConfig(config); Object result = client.execute(BALANCE, createBalanceArgs(balanceName, hostIDs, propertiesMap)); return ExternalSchedulerBrokerObjectBuilder.getBalanceResults(result).getResult(); } catch (XmlRpcException e) { <START> log.error("Error communicate with the external scheduler while balancing: {}", e.getMessage()); <END> log.debug("Exception", e); auditLogFailedToConnect(); return null; } }</code><technical_language>communicate Error communicating</technical_language>

Target:
public Pair<List<Guid>, Guid> runBalance(String balanceName, List<Guid> hostIDs, Map<String, String> propertiesMap) { try { XmlRpcClient client = new XmlRpcClient(); client.setConfig(config); Object result = client.execute(BALANCE, createBalanceArgs(balanceName, hostIDs, propertiesMap)); return ExternalSchedulerBrokerObjectBuilder.getBalanceResults(result).getResult(); } catch (XmlRpcException e) { log.error("Error communicating with the external scheduler while balancing: {}", e.getMessage()); log.debug("Exception", e); auditLogFailedToConnect(); return null; } }
Source:
<code>private void processEvents() { while ( state.get() == State.STARTED ) { try { int lastNegotiatedSessionTimeoutMs = client.getZookeeperClient().getLastNegotiatedSessionTimeoutMs(); int useSessionTimeoutMs = (lastNegotiatedSessionTimeoutMs > 0) ? lastNegotiatedSessionTimeoutMs : sessionTimeoutMs; long elapsedMs = startOfSuspendedEpoch == 0 ? 0 : System.currentTimeMillis() - startOfSuspendedEpoch; <START> long pollMaxMs = useSessionTimeoutMs - elapsedMs; <END> final ConnectionState newState = eventQueue.poll(pollMaxMs, TimeUnit.MILLISECONDS); if ( newState != null ) { if ( listeners.size() == 0 ) { log.warn("There are no ConnectionStateListeners registered."); } listeners.forEach ( new Function<ConnectionStateListener, Void>() { @Override public Void apply(ConnectionStateListener listener) { listener.stateChanged(client, newState); return null; } } ); } else if ( sessionExpirationPercent > 0 ) { synchronized(this) { checkSessionExpiration(); } } } catch ( InterruptedException e ) { } } }</code><technical_language>add a 50% factor something. suspicious wait entire session time if a suspended state</technical_language>

Target:
private void processEvents() { while ( state.get() == State.STARTED ) { try { int lastNegotiatedSessionTimeoutMs = client.getZookeeperClient().getLastNegotiatedSessionTimeoutMs(); int useSessionTimeoutMs = (lastNegotiatedSessionTimeoutMs > 0) ? lastNegotiatedSessionTimeoutMs : sessionTimeoutMs; long elapsedMs = startOfSuspendedEpoch == 0 ? useSessionTimeoutMs / 2 : System.currentTimeMillis() - startOfSuspendedEpoch; long pollMaxMs = useSessionTimeoutMs - elapsedMs; final ConnectionState newState = eventQueue.poll(pollMaxMs, TimeUnit.MILLISECONDS); if ( newState != null ) { if ( listeners.size() == 0 ) { log.warn("There are no ConnectionStateListeners registered."); } listeners.forEach ( new Function<ConnectionStateListener, Void>() { @Override public Void apply(ConnectionStateListener listener) { listener.stateChanged(client, newState); return null; } } ); } else if ( sessionExpirationPercent > 0 ) { synchronized(this) { checkSessionExpiration(); } } } catch ( InterruptedException e ) { } } }
Source:
<code><START> private Multimap<String, ?> extractParameters(DispatchCommand dcmd) { <END> String[] cmdArgs = dcmd.getArguments(); String paramName = null; int argPos = 0; Multimap<String, String> parms = ArrayListMultimap.create(); for (int i = 2; i < cmdArgs.length; i++) { String arg = cmdArgs[i]; if (arg.startsWith("-")) { if (paramName != null) { parms.put(paramName, null); } paramName = arg; } else { if (paramName == null) { parms.put("$" + argPos++, arg); } else { parms.put(paramName, arg); paramName = null; } } } if(paramName != null) { parms.put(paramName, null); } return parms; }</code><technical_language>This method a huge assumption user invoked command "-option arg" "-option=value arg". account -- stops option parsing</technical_language>

Target:
private Multimap<String, ?> extractParameters(DispatchCommand dcmd) { String[] cmdArgs = dcmd.getArguments(); String paramName = null; int argPos = 0; Multimap<String, String> parms = ArrayListMultimap.create(); for (int i = 2; i < cmdArgs.length; i++) { String arg = cmdArgs[i]; if (arg.equals("--")) { for (i = i + 1; i < cmdArgs.length; i++) parms.put("$" + argPos++, cmdArgs[i]); continue; } int eqPos = arg.indexOf('='); if (arg.startsWith("--") && eqPos > 0) { parms.put(arg.substring(0, eqPos), arg.substring(eqPos + 1)); continue; } if (arg.startsWith("-")) { if (paramName != null) { parms.put(paramName, null); } paramName = arg; continue; } if (paramName == null) { parms.put("$" + argPos++, arg); } else { parms.put(paramName, arg); paramName = null; } } if(paramName != null) { parms.put(paramName, null); } return parms; }
Source:
<code>private Store getStore(ExtensionContext extensionContext) { <START> return extensionContext.getStore(Namespace.create(getClass(), extensionContext.getUniqueId())); <END> }</code><technical_language>I changed in latest commit</technical_language>

Target:
private static Store getStore(ExtensionContext extensionContext) { return extensionContext.getStore(namespace); }
Source:
<code>@Override public Object decode(Response response, Type type) throws IOException { if (response.body() == null) { return null; } Reader reader = response.body().asReader(); try { <START> return mapper.readValue(reader, mapper.constructType(type)); <END> } finally { ensureClosed(reader); } }</code><technical_language>jackson runtime exceptions thrown here</technical_language>

Target:
@Override public Object decode(Response response, Type type) throws IOException { if (response.body() == null) { return null; } Reader reader = response.body().asReader(); try { return mapper.readValue(reader, mapper.constructType(type)); } catch (RuntimeJsonMappingException e) { if (e.getCause() != null && e.getCause() instanceof IOException) { throw IOException.class.cast(e.getCause()); } throw e; } }
Source:
<code>? AccessController.doPrivileged( initializeGetCallerStackAction ) : initializeGetCallerStackAction.run(); } private static Class<?> getCallerClass() { Class<?>[] stackTrace = System.getSecurityManager() != null ? AccessController.doPrivileged( GET_CALLER_STACK_ACTION ) : GET_CALLER_STACK_ACTION.run(); <START> if ( stackTrace.length < 4 ) { <END> throw new SecurityException( "Unable to determine the caller class" ); } boolean hibernateMethodLookupDispatcherDetected = false; int maxFrames = Math.min( MAX_STACK_FRAMES, stackTrace.length ); for ( int i = 3; i < maxFrames; i++ ) { if ( stackTrace[i].getName().equals( HibernateMethodLookupDispatcher.class.getName() ) ) { hibernateMethodLookupDispatcherDetected = true; continue; } if ( hibernateMethodLookupDispatcherDetected ) { return stackTrace[i]; } } throw new SecurityException( "Unable to determine the caller class" ); }</code><technical_language>way, this 3. able put in a constant (same for 3 in loop below)</technical_language>

Target:
? AccessController.doPrivileged( initializeGetCallerStackAction ) : initializeGetCallerStackAction.run(); } private static Class<?> getCallerClass() { Class<?>[] stackTrace = System.getSecurityManager() != null ? AccessController.doPrivileged( GET_CALLER_STACK_ACTION ) : GET_CALLER_STACK_ACTION.run(); if ( stackTrace.length <= MIN_STACK_FRAMES ) { throw new SecurityException( "Unable to determine the caller class" ); } boolean hibernateMethodLookupDispatcherDetected = false; int maxFrames = Math.min( MAX_STACK_FRAMES, stackTrace.length ); for ( int i = MIN_STACK_FRAMES; i < maxFrames; i++ ) { if ( stackTrace[i].getName().equals( HibernateMethodLookupDispatcher.class.getName() ) ) { hibernateMethodLookupDispatcherDetected = true; continue; } if ( hibernateMethodLookupDispatcherDetected ) { return stackTrace[i]; } } throw new SecurityException( "Unable to determine the caller class" ); }
Source:
<code>protected Collection<ITmfMatchEventDefinition> getEventDefinitions(ITmfTrace trace) { <START> return fMatchMap.get(trace); <END> }</code><technical_language>this immutable copy of collection</technical_language>

Target:
protected Collection<ITmfMatchEventDefinition> getEventDefinitions(ITmfTrace trace) { return ImmutableList.copyOf(fMatchMap.get(trace)); }
Source:
<code>protected Double map(final Traverser.Admin<S> traverser) { <START> final Expression expression = new ExpressionBuilder(this.equation) <END> .variables(this.variables) .implicitMultiplication(false) .build(); for (final String var : this.variables) { expression.setVariable(var, TraversalUtil.applyNullable( var.equals(CURRENT) ? traverser.get() : this.getNullableScopeValue(Pop.last, var, traverser), this.traversalRing.next()).doubleValue()); } this.traversalRing.reset(); return expression.evaluate(); }</code><technical_language>exp4j source, I Expression reused. If so, this moved constructor save repeated initialization cost</technical_language>

Target:
protected Double map(final Traverser.Admin<S> traverser) { final Expression localExpression = new Expression(this.expression); for (final String var : this.variables) { localExpression.setVariable(var, var.equals(CURRENT) ? TraversalUtil.applyNullable(traverser, this.traversalRing.next()).doubleValue() : TraversalUtil.applyNullable((S) this.getNullableScopeValue(Pop.last, var, traverser), this.traversalRing.next()).doubleValue()); } this.traversalRing.reset(); return localExpression.evaluate(); }
Source:
<code>private void deleteRepositoryContent( final List<RepositoryNode> selectedNodes, final boolean deleteWorkDir) throws IOException { for (RepositoryNode node : selectedNodes) { Repository repo = node.getRepository(); if (!repo.isBare() && deleteWorkDir) { File[] files = repo.getWorkTree().listFiles(); if (files != null) for (File file : files) { if (isTracked(file, repo)) FileUtils.delete(file, FileUtils.RECURSIVE | FileUtils.RETRY); } } repo.close(); FileUtils.delete(repo.getDirectory(), FileUtils.RECURSIVE | FileUtils.RETRY | FileUtils.SKIP_MISSING); if (deleteWorkDir && !repo.isBare() && node.getParent() != null && node.getParent().getType() == RepositoryTreeNodeType.SUBMODULES) { FileUtils.delete(repo.getWorkTree(), FileUtils.RECURSIVE | FileUtils.RETRY | FileUtils.SKIP_MISSING); node.getParent().getRepository().notifyIndexChanged(); } <START> String[] files = repo.getWorkTree().list(); <END> boolean isWorkingDirEmpty = files != null && files.length == 0; if (deleteWorkDir && isWorkingDirEmpty) { FileUtils.delete(repo.getWorkTree(), FileUtils.RETRY | FileUtils.SKIP_MISSING); } } }</code><technical_language>I check for !repo.isBare() calling getWorkTree() here. combine check for deleteWorkDir, above: if (deleteWorkDir && !repo.isBare()) { // ... }</technical_language>

Target:
private void deleteRepositoryContent( final List<RepositoryNode> selectedNodes, final boolean deleteWorkDir) throws IOException { for (RepositoryNode node : selectedNodes) { Repository repo = node.getRepository(); File workTree = deleteWorkDir && !repo.isBare() ? repo.getWorkTree() : null; if (workTree != null) { File[] files = workTree.listFiles(); if (files != null) for (File file : files) { if (isTracked(file, repo)) FileUtils.delete(file, FileUtils.RECURSIVE | FileUtils.RETRY); } } repo.close(); FileUtils.delete(repo.getDirectory(), FileUtils.RECURSIVE | FileUtils.RETRY | FileUtils.SKIP_MISSING); if (workTree != null) { if (node.getParent() != null && node.getParent().getType() == RepositoryTreeNodeType.SUBMODULES) { FileUtils.delete(workTree, FileUtils.RECURSIVE | FileUtils.RETRY | FileUtils.SKIP_MISSING); node.getParent().getRepository().notifyIndexChanged(); } String[] files = workTree.list(); boolean isWorkingDirEmpty = files != null && files.length == 0; if (isWorkingDirEmpty) FileUtils.delete(workTree, FileUtils.RETRY | FileUtils.SKIP_MISSING); } } }
Source:
<code>public PythonVisitorContext(AstNode rootTree, PythonFile pythonFile) { this(rootTree, pythonFile, null); <START> symbolTable = new SymbolTableBuilderVisitor(); <END> symbolTable.scanFile(this); }</code><technical_language>@pynicolas voltige! this simpler understand complying usual contract of a builder object: symbolTable = new SymbolTableBuilderVisitor().with(this).build(); removing "Visitor" SymbolTableBuilderVisitor</technical_language>

Target:
public PythonVisitorContext(AstNode rootTree, PythonFile pythonFile) { this(rootTree, pythonFile, null); SymbolTableBuilderVisitor symbolTableBuilderVisitor = new SymbolTableBuilderVisitor(); symbolTableBuilderVisitor.scanFile(this); symbolTable = symbolTableBuilderVisitor.symbolTable(); }
Source:
<code>private static void testCreateUser() throws MambuApiException { String methodName = new Object() {}.getClass().getEnclosingMethod().getName(); System.out.println("\nIn " + methodName); UsersService usersService = MambuAPIFactory.getUsersService(); List<Role> userRoles = usersService.getUserRoles(); if(CollectionUtils.isEmpty(userRoles)){ <START> System.out.println("WARNING: There are no roles in the appication! User can`t be created wih"); <END> System.out.println("User can`t be created wihout a role"); } long currentTime = System.currentTimeMillis(); User userToBeCreated = new User(); userToBeCreated.setRole(userRoles.get(0)); userToBeCreated.setFirstName("API"); userToBeCreated.setLastName("User "); userToBeCreated.setUsername("ApiUser" + currentTime); userToBeCreated.setPassword("password2010"); userToBeCreated.setNotes("User created through SDK " + currentTime); Permissions permissions = new Permissions(); permissions.setCanManageAllBranches(true); permissions.setCanManageEntitiesAssignedToOtherOfficers(true); userToBeCreated.setPermissions(permissions); User createdUser = usersService.createUser(userToBeCreated); if(createdUser == null){ System.out.println("The new user couldn`t be created!"); return; } System.out.println("Details of the newly created user:"); logIndividualUserDetails(createdUser); }</code><technical_language>wih? :)</technical_language>

Target:
private static void testCreateUser() throws MambuApiException { String methodName = new Object() {}.getClass().getEnclosingMethod().getName(); System.out.println("\nIn " + methodName); UsersService usersService = MambuAPIFactory.getUsersService(); List<Role> userRoles = usersService.getUserRoles(); if(CollectionUtils.isEmpty(userRoles)){ System.out.println("WARNING: There are no roles in the appication!"); System.out.println("User can`t be created without a role"); return; } long currentTime = System.currentTimeMillis(); User userToBeCreated = new User(); userToBeCreated.setRole(userRoles.get(0)); userToBeCreated.setFirstName("API"); userToBeCreated.setLastName("User "); userToBeCreated.setUsername("ApiUser" + currentTime); userToBeCreated.setPassword("password2010"); userToBeCreated.setNotes("User created through SDK " + currentTime); Permissions permissions = new Permissions(); permissions.setCanManageAllBranches(true); permissions.setCanManageEntitiesAssignedToOtherOfficers(true); userToBeCreated.setPermissions(permissions); User createdUser = usersService.createUser(userToBeCreated); if(createdUser == null){ System.out.println("The new user couldn`t be created!"); return; } System.out.println("Details of the newly created user:"); logIndividualUserDetails(createdUser); }
Source:
<code>private GatewayStatusComparison(ChargeEntity charge, ChargeQueryResponse gatewayQueryResponse) { chargeId = charge.getExternalId(); payStatus = ChargeStatus.fromString(charge.getStatus()); <START> gatewayStatus = gatewayQueryResponse.getMappedStatus().isPresent() ? <END> gatewayQueryResponse.getMappedStatus().get() : null; rawGatewayResponse = gatewayQueryResponse.getRawGatewayResponse(); this.charge = charge; }</code><technical_language>getGatewayStatus a return Optional<ChargeStatus> is called canBeCancelled() DiscrepancyService as: !gatewayStatusComparison.getGatewayStatus().toExternal().isFinished() && potential NPE if getGatewayStatus() returns null</technical_language>

Target:
private GatewayStatusComparison(ChargeEntity charge, ChargeQueryResponse gatewayQueryResponse) { chargeId = charge.getExternalId(); payStatus = ChargeStatus.fromString(charge.getStatus()); gatewayStatus = gatewayQueryResponse.getMappedStatus(); rawGatewayResponse = gatewayQueryResponse.getRawGatewayResponse(); this.charge = charge; }
Source:
<code>public static void main(String[] args) throws Exception { Builder builder = Builder.createBuilder(); Streamlet<Integer> zeroes = builder.newSource(() -> 0); <START> builder.newSource(() -> ThreadLocalRandom.current().nextInt(1, 11)) <END> .setNumPartitions(5) .setName("random-ints") .map(i -> i + 1) .setName("add-one") .repartition(2) .setName("repartition") .union(zeroes) .setName("unify-streams") .filter(i -> i != 2) .setName("remove-twos") .log(); Config conf = new Config(); conf.setNumContainers(NUM_CONTAINERS); Resources resources = new Resources(); resources.withCpu(CPU); resources.withRam(ByteAmount.fromGigabytes(GIGABYTES_OF_RAM).asBytes()); conf.setContainerResources(resources); String topologyName = StreamletUtils.getTopologyName(args); new Runner().run(topologyName, conf, builder); }</code><technical_language>need a example for repartition</technical_language>

Target:
public static void main(String[] args) throws Exception { Builder builder = Builder.createBuilder(); Streamlet<Integer> zeroes = builder.newSource(() -> 0); builder.newSource(() -> ThreadLocalRandom.current().nextInt(1, 11)) .setNumPartitions(2) .setName("random-ints") .map(i -> i + 1) .setName("add-one") .union(zeroes) .setName("unify-streams") .filter(i -> i != 2) .setName("remove-twos") .log(); Config conf = new Config(); conf.setNumContainers(NUM_CONTAINERS); Resources resources = new Resources(); resources.withCpu(CPU); resources.withRam(ByteAmount.fromGigabytes(GIGABYTES_OF_RAM).asBytes()); conf.setContainerResources(resources); String topologyName = StreamletUtils.getTopologyName(args); new Runner().run(topologyName, conf, builder); }
Source:
<code>public Future<String> convert(RestRequest restRequest, String input, BlobInfo blobInfo, Callback<String> callback) { final CompletableFuture<String> future = new CompletableFuture<>(); String convertedId = null; Exception exception = null; frontendMetrics.idConverterRequestRate.mark(); long startTimeInMs = System.currentTimeMillis(); try { if (!isOpen) { <START> frontendMetrics.idConverterProcessingTimeInMs.update(System.currentTimeMillis() - startTimeInMs); <END> exception = new RestServiceException("IdConverter is closed", RestServiceErrorCode.ServiceUnavailable); } else if (restRequest.getRestMethod().equals(RestMethod.POST)) { convertedId = "/" + signIdIfRequired(restRequest, input); } else { frontendMetrics.idConverterProcessingTimeInMs.update(System.currentTimeMillis() - startTimeInMs); convertId(input, restRequest, blobInfo).whenComplete( (id, throwable) -> completeConversion(id, extractCompletionExceptionCause(throwable), future, callback)); } } catch (Exception e) { exception = e; } finally { frontendMetrics.idConverterProcessingTimeInMs.update(System.currentTimeMillis() - startTimeInMs); if (convertedId != null || exception != null) { completeConversion(convertedId, exception, future, callback); } } return future; }</code><technical_language>a quick question. Do need update idConverterProcessingTimeInMs eventually finally logic do it</technical_language>

Target:
public Future<String> convert(RestRequest restRequest, String input, BlobInfo blobInfo, Callback<String> callback) { final CompletableFuture<String> future = new CompletableFuture<>(); String convertedId = null; Exception exception = null; frontendMetrics.idConverterRequestRate.mark(); long startTimeInMs = System.currentTimeMillis(); try { if (!isOpen) { exception = new RestServiceException("IdConverter is closed", RestServiceErrorCode.ServiceUnavailable); } else if (restRequest.getRestMethod().equals(RestMethod.POST)) { convertedId = "/" + signIdIfRequired(restRequest, input); } else { convertId(input, restRequest, blobInfo).whenComplete( (id, throwable) -> completeConversion(id, extractCompletionExceptionCause(throwable), future, callback)); } } catch (Exception e) { exception = e; } finally { frontendMetrics.idConverterProcessingTimeInMs.update(System.currentTimeMillis() - startTimeInMs); if (convertedId != null || exception != null) { completeConversion(convertedId, exception, future, callback); } } return future; }
Source:
<code>public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; <START> if (getClass() != obj.getClass()) <END> return false; PairQueryable other = (PairQueryable) obj; if (getPair() == null) { if (other.getPair() != null) return false; } else if (!getPair().equals(other.getPair())) return false; return true; }</code><technical_language>please replace instanceOf (you regenerate in eclipse checking right options)</technical_language>

Target:
public boolean equals(Object obj) { if (this == obj) { return true; } if (obj == null) { return false; } if (!(obj instanceof PairQueryable)) { return false; } PairQueryable other = (PairQueryable) obj; if (getPair() == null) { if (other.getPair() != null) { return false; } } else if (!getPair().equals(other.getPair())) { return false; } return true; }
Source:
<code>public VxLanPort bridgeCreateVxLanPort( UUID bridgeId, IPv4Addr mgmtIp, int mgmtPort, int vni, IPv4Addr tunnelIp, UUID tunnelZoneId) throws StateAccessException, SerializationException { BridgeConfig bridgeConfig = bridgeZkManager.get(bridgeId); if (bridgeConfig.vxLanPortId != null) { if (!bridgeConfig.vxLanPortIds.contains(bridgeConfig.vxLanPortId)) { bridgeConfig.vxLanPortIds.add(bridgeConfig.vxLanPortId); <START> log.info("Migrate legacy vxlanPortId on bridge {}", bridgeId); <END> } } for (UUID id: bridgeConfig.vxLanPortIds) { VxLanPort p = (VxLanPort)portsGet(id); if (p.getMgmtIpAddr().equals(mgmtIp)) { throw new IllegalStateException( "Not expected to find a port for vtep " + mgmtIp); } } VxLanPort port = new VxLanPort(bridgeId, mgmtIp, mgmtPort, vni, tunnelIp, tunnelZoneId); PortConfig portConfig = Converter.toPortConfig(port); List<Op> ops = new ArrayList<>(); ops.addAll(portZkManager.prepareCreate(port.getId(), portConfig)); bridgeConfig.vxLanPortIds.add(port.getId()); ops.addAll(bridgeZkManager.prepareUpdate(bridgeId, bridgeConfig)); zkManager.multi(ops); return port; }</code><technical_language>please log messages a bit more end-user readable: "vxlanPortId" --> VxLAN port "migrate legacy..." means, is a suggestion user doing? If "migrating"</technical_language>

Target:
public VxLanPort bridgeCreateVxLanPort( UUID bridgeId, IPv4Addr mgmtIp, int mgmtPort, int vni, IPv4Addr tunnelIp, UUID tunnelZoneId) throws StateAccessException, SerializationException { BridgeConfig bridgeConfig = bridgeZkManager.get(bridgeId); if (bridgeConfig.vxLanPortId != null) { if (!bridgeConfig.vxLanPortIds.contains(bridgeConfig.vxLanPortId)) { bridgeConfig.vxLanPortIds.add(bridgeConfig.vxLanPortId); log.debug("Lazy update of Bridge schema: existing VTEP" + "binding migrated to new schema in {}", bridgeId); } } for (UUID id: bridgeConfig.vxLanPortIds) { VxLanPort p = (VxLanPort)portsGet(id); if (p.getMgmtIpAddr().equals(mgmtIp)) { throw new IllegalStateException( "Not expected to find a port for vtep " + mgmtIp); } } VxLanPort port = new VxLanPort(bridgeId, mgmtIp, mgmtPort, vni, tunnelIp, tunnelZoneId); PortConfig portConfig = Converter.toPortConfig(port); List<Op> ops = new ArrayList<>(); ops.addAll(portZkManager.prepareCreate(port.getId(), portConfig)); bridgeConfig.vxLanPortIds.add(port.getId()); ops.addAll(bridgeZkManager.prepareUpdate(bridgeId, bridgeConfig)); zkManager.multi(ops); return port; }
Source:
<code>public void zkConnectionPolicy_Session() throws Exception { mCluster = MultiProcessCluster.newBuilder(PortCoordination.ZOOKEEPER_CONNECTION_POLICY_SESSION) .setClusterName("ZookeeperConnectionPolicy_Session") .setNumMasters(2) <START> .setNumWorkers(1) <END> .addProperty(PropertyKey.ZOOKEEPER_LEADER_CONNECTION_ERROR_POLICY, "SESSION") .addProperty(PropertyKey.MASTER_JOURNAL_TYPE, JournalType.UFS.toString()) .build(); mCluster.start(); int leaderIdx = getPrimaryMasterIndex(); mCluster.restartZk(); int leaderIdx2 = getPrimaryMasterIndex(); assertEquals(leaderIdx, leaderIdx2); mCluster.notifySuccess(); }</code><technical_language>do need workers</technical_language>

Target:
public void zkConnectionPolicy_Session() throws Exception { mCluster = MultiProcessCluster.newBuilder(PortCoordination.ZOOKEEPER_CONNECTION_POLICY_SESSION) .setClusterName("ZookeeperConnectionPolicy_Session") .setNumMasters(2) .setNumWorkers(0) .addProperty(PropertyKey.ZOOKEEPER_LEADER_CONNECTION_ERROR_POLICY, "SESSION") .addProperty(PropertyKey.MASTER_JOURNAL_TYPE, JournalType.UFS.toString()) .build(); mCluster.start(); int leaderIdx = getPrimaryMasterIndex(); mCluster.restartZk(); int leaderIdx2 = getPrimaryMasterIndex(); assertEquals(leaderIdx, leaderIdx2); mCluster.notifySuccess(); }
Source:
<code>public static String getPath() { CtfCoreTestPlugin plugin = CtfCoreTestPlugin.getDefault(); if (plugin == null) { return null; } Path tracePath = Paths.get("..", "..", "ctf", "org.eclipse.tracecompass.ctf.core.tests", TRACES_DIRECTORY, TRACE_NAME); tracePath = tracePath.toAbsolutePath(); File file = tracePath.toFile(); <START> if (file.exists()) { <END> deleteTrace(tracePath); } generateLttngKernelTrace(file); return file.getAbsolutePath(); }</code><technical_language>do this check</technical_language>

Target:
public static String getPath() { CtfCoreTestPlugin plugin = CtfCoreTestPlugin.getDefault(); if (plugin == null) { return null; } Path tracePath = Paths.get("..", "..", "ctf", "org.eclipse.tracecompass.ctf.core.tests", TRACES_DIRECTORY, TRACE_NAME); tracePath = tracePath.toAbsolutePath(); File file = tracePath.toFile(); generateLttngKernelTrace(file); return file.getAbsolutePath(); }
Source:
<code>private static BuiltInFunctionInfo get(String normalizedName, List<ParseNode> children) { initBuiltInFunctionMap(); BuiltInFunctionInfo info = BUILT_IN_FUNCTION_MAP.get(new BuiltInFunctionKey(normalizedName,children.size())); if (info == null) { <START> throw new IllegalArgumentException(normalizedName); <END> } return info; }</code><technical_language>throw more specific (maybe RuntimeException) catch. Or, re-throw a RecognitionException a catch block in call factory.function above</technical_language>

Target:
private static BuiltInFunctionInfo get(String normalizedName, List<ParseNode> children) { initBuiltInFunctionMap(); BuiltInFunctionInfo info = BUILT_IN_FUNCTION_MAP.get(new BuiltInFunctionKey(normalizedName,children.size())); if (info == null) { throw new UnknownFunctionException(normalizedName); } return info; }
Source:
<code>public void push(RowMap r) throws Exception { String payload = r.toJSON(outputConfig); ByteArrayContent content = ByteArrayContent.fromString(Json.MEDIA_TYPE, payload); HttpRequest request = requestFactory.buildPostRequest(requestUrl, content); HttpHeaders headers = request.getHeaders(); headers.setContentLength(content.getLength()); headers.setDate(getDateString()); <START> headers.set("digest", digestHeader(DEFAULT_DIGEST_ALGO, DEFAULT_CHARSET, payload)); <END> request.execute(); lastRequest = request; this.context.setPosition(r); }</code><technical_language>left I</technical_language>

Target:
public void push(RowMap r) throws Exception { String payload = r.toJSON(outputConfig); ByteArrayContent content = ByteArrayContent.fromString(Json.MEDIA_TYPE, payload); HttpRequest request = requestFactory.buildPostRequest(requestUrl, content); request.execute(); lastRequest = request; this.context.setPosition(r); }
Source:
<code>public LocalizedString getDisplayNames() { if (displayName == null) { String simple = context.getState().getLabel(); if (simple != null) { <START> displayName = resolveExpression(simple); <END> } else if (context.getId() != null) { Map<Locale, Described.State> descriptions = navigation.loadDescriptions(context.getId()); displayName = ObjectFactory.createLocalizedString(descriptions); } } return displayName; }</code><technical_language>slight perf cost resource bundles resolve languages calls getDisplayNames(). case this done. getDisplayName() properly resolves label</technical_language>

Target:
public LocalizedString getDisplayNames() { if (displayName == null) { String simple = context.getState().getLabel(); if (simple != null) { displayName = navigation.resolveExpression(simple); } else if (context.getId() != null) { Map<Locale, Described.State> descriptions = navigation.loadDescriptions(context.getId()); displayName = ObjectFactory.createLocalizedString(descriptions); } } return displayName; }
Source:
<code>public WorkflowResponse execute(WorkflowDTO workflowDTO) throws WorkflowException { if (log.isDebugEnabled()) { log.debug("Executing Application creation Workflow."); } ApplicationWorkflowDTO appWorkFlowDTO = (ApplicationWorkflowDTO) workflowDTO; Application application = appWorkFlowDTO.getApplication(); String callBackURL = appWorkFlowDTO.getCallbackUrl(); String message="Approve application ["+ application.getName() +"] creation request from application creator -" +appWorkFlowDTO.getUserName()+" with throttling tier - "+application.getTier(); workflowDTO.setWorkflowDescription(message); workflowDTO.setMetadata("applicationName", application.getName()); workflowDTO.setMetadata("applicationTier", application.getTier()); workflowDTO.setMetadata("applicationCallbackUrl", application.getCallbackUrl()); workflowDTO.setMetadata("applicationDescription", application.getDescription()); workflowDTO.setMetadata("tenantDomain", appWorkFlowDTO.getTenantDomain()); workflowDTO.setMetadata("userName", appWorkFlowDTO.getUserName()); workflowDTO.setMetadata("workflowExternalRef", appWorkFlowDTO.getExternalWorkflowReference()); workflowDTO.setMetadata("callBackURL", callBackURL != null ? callBackURL : "?"); <START> workflowDTO.setProperties("Workflow Process","Application Creation"); <END> super.execute(workflowDTO); return new GeneralWorkflowResponse(); }</code><technical_language>need set this</technical_language>

Target:
public WorkflowResponse execute(WorkflowDTO workflowDTO) throws WorkflowException { if (log.isDebugEnabled()) { log.debug("Executing Application creation Workflow."); } ApplicationWorkflowDTO appWorkFlowDTO = (ApplicationWorkflowDTO) workflowDTO; Application application = appWorkFlowDTO.getApplication(); String callBackURL = appWorkFlowDTO.getCallbackUrl(); String message = "Approve application [" + application.getName() + "] creation request from application creator -" + appWorkFlowDTO.getUserName() + " with throttling tier - " + application.getTier(); workflowDTO.setWorkflowDescription(message); super.execute(workflowDTO); return new GeneralWorkflowResponse(); }
Source:
<code>public static String cleanUrl(String url) { return url.contains("/#/") ? url.substring(0, url.indexOf("/#/")) <START> : url; <END> }</code><technical_language>I suggest this? int i = url.indexOf("/#/"); return i == -1 ? url : url.substring(0, i); searches string once, more important, duplicate search argument</technical_language>

Target:
public static String cleanUrl(String url) { int index = url.indexOf("/#/"); return index == -1 ? url : url.substring(0, index); }
Source:
<code>public String toString() { <START> return uniqueRuleId; <END> }</code><technical_language>Add checkType toString()</technical_language>

Target:
public String toString() { return String.format("%s %s", id, checkType.getName()); }
Source:
<code>public Node visit(PackageDeclaration _n, Object _arg) { List<AnnotationExpr> annotations = visit(_n.getAnnotations(), _arg); NameExpr name = cloneNodes(_n.getName(), _arg); Comment comment = cloneNodes(_n.getComment(), _arg); PackageDeclaration r = new PackageDeclaration( _n.getBeginLine(), _n.getBeginColumn(), _n.getEndLine(), _n.getEndColumn(), annotations, name ); r.setComment(comment); <START> for (Comment oc : _n.getOrphanComments()) { <END> r.addOrphanComment(oc); } return r; }</code><technical_language>This lines appars times in file. abstracting out a method, reduce size of diffs upstream</technical_language>

Target:
public Node visit(PackageDeclaration _n, Object _arg) { List<AnnotationExpr> annotations = visit(_n.getAnnotations(), _arg); NameExpr name = cloneNodes(_n.getName(), _arg); Comment comment = cloneNodes(_n.getComment(), _arg); PackageDeclaration r = new PackageDeclaration( _n.getBeginLine(), _n.getBeginColumn(), _n.getEndLine(), _n.getEndColumn(), annotations, name ); r.setComment(comment); addOrphanCommentsToNode(_n, r); return r; }