auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
Node optimizeSubtree(Node subtree) { if (!subtree.isScript() && !subtree.isBlock()) { return subtree; } boolean codeChanged = false; for (Node child = subtree.getFirstChild(); child != null; child = child.getNext()) { if (isArrayDotPush(child)) { Node next = child.getNext(); if (isArrayDotPush(next)) { Node firstCall = child.getFirstChild(); Node secondCall = next.getFirstChild(); String firstArrayName = firstCall.getFirstChild().getFirstChild().getString(); String secondArrayName = secondCall.getFirstChild().getFirstChild().getString(); if (firstArrayName.equals(secondArrayName)) { Node secondArgument = secondCall.getFirstChild().getNext(); while (secondArgument != null) { Node temp = secondArgument.getNext(); firstCall.addChildToBack(secondArgument.detach()); secondArgument = temp; } subtree.removeChild(next); codeChanged = true; } } } } if (codeChanged) { reportChangeToEnclosingScope(subtree); } return subtree; }

Target:
Node optimizeSubtree(Node subtree) { if (!subtree.isScript() && !subtree.isBlock()) { return subtree; } boolean codeChanged = false; for (Node statement = subtree.getFirstChild(); statement != null; statement = statement.getNext()) { ArrayDotPushStatementSequence arrayDotPushStatementSequence = asArrayDotPushStatementSequence(statement); if (arrayDotPushStatementSequence != null) { arrayDotPushStatementSequence.combine(subtree); codeChanged = true; } } if (codeChanged) { reportChangeToEnclosingScope(subtree); } return subtree; }
Source:
private String getLanguageCountryCode(Locale locale) { String result = locale.getLanguage(); if (!locale.getCountry().isEmpty()) { result += locale.getCountry(); } return result; }

Target:
private String getLanguageCountryCode(Locale locale) { String result = locale.getLanguage(); if (!locale.getCountry().isEmpty()) { result += "-" + locale.getCountry(); } return result; }
Source:
private void increaseBuffersInBacklog(BufferConsumer buffer) { assert Thread.holdsLock(buffers); if (buffer != null && buffer.isBuffer()) { buffersInBacklog++; parent.notifyIncreaseBacklog(buffersInBacklog); } }

Target:
private void increaseBuffersInBacklog(BufferConsumer buffer) { assert Thread.holdsLock(buffers); if (buffer != null && buffer.isBuffer()) { buffersInBacklog++; } }
Source:
public Set<Type> getTypes() { HashSet<Type> types = new HashSet<Type>(); types.add(BuilderInterceptorInstance.class); types.add(Object.class); return types; }

Target:
public Set<Type> getTypes() { return types; }
Source:
void testFirstElement() { Object object = new Object(); Object object2 = new Object(); assertEquals( object, Iterables.first( asList( object, object2 ) ) ); assertEquals( object, Iterables.first( asList( object ) ) ); try { Iterables.first( asList() ); fail( "Should fail" ); } catch ( NoSuchElementException e ) { } assertEquals( object, Iterators.first( asList( object, object2 ).iterator() ) ); assertEquals( object, Iterators.first( asList( object ).iterator() ) ); try { Iterators.first( asList().iterator() ); fail( "Should fail" ); } catch ( NoSuchElementException e ) { } assertEquals( object, Iterables.firstOrNull( asList( object, object2 ) ) ); assertEquals( object, Iterables.firstOrNull( asList( object ) ) ); assertNull( Iterables.firstOrNull( asList() ) ); assertEquals( object, Iterators.firstOrNull( asList( object, object2 ).iterator() ) ); assertEquals( object, Iterators.firstOrNull( asList( object ).iterator() ) ); assertNull( Iterators.firstOrNull( asList().iterator() ) ); }

Target:
void testFirstElement() { Object object = new Object(); Object object2 = new Object(); assertEquals( object, Iterables.first( asList( object, object2 ) ) ); assertEquals( object, Iterables.first( asList( object ) ) ); assertThrows( NoSuchElementException.class, () -> Iterables.first( asList() ) ); assertEquals( object, Iterators.first( asList( object, object2 ).iterator() ) ); assertEquals( object, Iterators.first( asList( object ).iterator() ) ); assertThrows( NoSuchElementException.class, () -> Iterators.first( asList().iterator() ) ); assertEquals( object, Iterables.firstOrNull( asList( object, object2 ) ) ); assertEquals( object, Iterables.firstOrNull( asList( object ) ) ); assertNull( Iterables.firstOrNull( asList() ) ); assertEquals( object, Iterators.firstOrNull( asList( object, object2 ).iterator() ) ); assertEquals( object, Iterators.firstOrNull( asList( object ).iterator() ) ); assertNull( Iterators.firstOrNull( asList().iterator() ) ); }
Source:
private void summonNecromancer() { necromancer = new ThreadPoolExecutor(1, 1, 0L, TimeUnit.MILLISECONDS, new BoundedQueue<>(numberOfPendingFutures), new ThreadFactoryBuilder() .setNameFormat("FastObjectLoaderReaderThread-%d").build()); futureList = new ArrayList<>(); }

Target:
private void summonNecromancer() { necromancer = new ThreadPoolExecutor(1, 1, 0L, TimeUnit.MILLISECONDS, new BoundedQueue<>(numberOfPendingFutures), new ThreadFactoryBuilder() .setNameFormat("FastObjectLoaderReaderThread-%d").build()); lastReadRequest = null; }
Source:
public void stop() { ChangeIndex read = searchIndex.get(); if (read != null) { read.close(); } for (ChangeIndex write : writeIndexes) { if (write != read) { read.close(); } } }

Target:
public void stop() { ChangeIndex read = searchIndex.get(); if (read != null) { read.close(); } for (ChangeIndex write : writeIndexes) { if (write != read) { write.close(); } } }
Source:
protected void doFilterInternal(HttpServletRequest request, HttpServletResponse response, FilterChain filterChain) throws ServletException, IOException { HeaderWriterResponse headerWriterResponse = new HeaderWriterResponse(request, response, compositeHeaderWriter); HeaderWriterRequest headerWriterRequest = new HeaderWriterRequest(request, headerWriterResponse); try { filterChain.doFilter(headerWriterRequest, headerWriterResponse); } finally { headerWriterResponse.writeHeaders(); } }

Target:
protected void doFilterInternal(HttpServletRequest request, HttpServletResponse response, FilterChain filterChain) throws ServletException, IOException { HeaderWriterResponse headerWriterResponse = new HeaderWriterResponse(request, response, this.headerWriter); HeaderWriterRequest headerWriterRequest = new HeaderWriterRequest(request, headerWriterResponse); try { filterChain.doFilter(headerWriterRequest, headerWriterResponse); } finally { headerWriterResponse.writeHeaders(); } }
Source:
public VideoCopy createCopyInLibrary(Library library, Video video, VideoMedium medium) { return copyRepo.save( library.add( video, medium ) ); }

Target:
public VideoCopy createCopyInLibrary(Library library, Video video, VideoMedium medium) { VideoCopy copy = new VideoCopy(); copy.setLibrary( library ); library.getCopies().add( copy ); copy.setDocument( video ); video.getCopies().add( copy ); copy.setMedium( medium ); return copyRepo.save( copy ); }
Source:
void foo() { Integer i = 123456789; Float f = 1.0f; Number n = true ? i : f; Object o1 = new Object(); A a2 = new A(); o1 = true ? o1 : a2; o1 = true ? f : a2; n = true ? (Float) i : f; }

Target:
void foo() { long l = 123456789123456789L; Integer i1 = 123456789; int i2 = 123456789; Float f1 = 1.0f; Object o1 = new Object(); A a2 = new A(); Number n = true ? i1 : f1; o1 = true ? o1 : a2; o1 = true ? f1 : a2; n = true ? (Number) i1 : f1; l = true ? i2 : l; float f2 = 0.2f; l = (long) (true ? i2 : f2); n = true ? Long.valueOf(i1) : (Long) l; }
Source:
public void endProcessingNode() { if (nodeCount.decrementAndGet() == 0 && recorder != null) { Node node = rootNode.build(); trace.setTimestamp(node.getTimestamp()); trace.setTransaction(getTransaction()); trace.getNodes().add(node); if (checkForSamplingProperties(node)) { reportingLevel = ReportingLevel.All; } boolean sampled = ContextSampler.isSampled(sampler, trace, reportingLevel); if (sampled && reportingLevel == null) { reportingLevel = ReportingLevel.All; } if (sampled) { recorder.report(trace); } } }

Target:
public void endProcessingNode() { if (nodeCount.decrementAndGet() == 0 && recorder != null) { Node node = rootNode.build(); trace.setTimestamp(node.getTimestamp()); trace.setTransaction(getTransaction()); trace.getNodes().add(node); if (checkForSamplingProperties(node)) { reportingLevel = ReportingLevel.All; } boolean sampled = sampler.isSampled(trace, reportingLevel); if (sampled && reportingLevel == null) { reportingLevel = ReportingLevel.All; } if (sampled) { recorder.report(trace); } } }
Source:
public HiveTableInstance createImmutable(HiveTableDefinition tableDefinition, TableHandle tableHandle) { checkState(!tableDefinition.isPartitioned(), "Partitioning not supported for immutable tables"); TableName tableName = createImmutableTableName(tableHandle); LOGGER.debug("creating immutable table {}", tableHandle.getName()); String tableDataPath = getImmutableTableHdfsPath(tableDefinition.getDataSource()); uploadTableData(tableDataPath, tableDefinition.getDataSource()); dropTableIgnoreError(tableName); createTable(tableDefinition, tableName, Optional.of(tableDataPath)); markTableAsExternal(tableName); if (analyzeImmutableTables && tableDefinition.getDataSource().getStatistics().isPresent()) { checkState(!tableDefinition.isPartitioned(), "Statisitcs are not yet supported for parititioned tables"); hiveThriftClient.setStatistics(tableName, tableDefinition.getDataSource().getStatistics().get()); } return new HiveTableInstance(tableName, tableDefinition); }

Target:
public HiveTableInstance createImmutable(HiveTableDefinition tableDefinition, TableHandle tableHandle) { checkState(!tableDefinition.isPartitioned(), "Partitioning not supported for immutable tables"); TableName tableName = createImmutableTableName(tableHandle); LOGGER.debug("creating immutable table {}", tableHandle.getName()); String tableDataPath = getImmutableTableHdfsPath(tableDefinition.getDataSource()); uploadTableData(tableDataPath, tableDefinition.getDataSource()); dropTableIgnoreError(tableName); createTable(tableDefinition, tableName, Optional.of(tableDataPath)); markTableAsExternal(tableName); if (analyzeImmutableTables && tableDefinition.getDataSource().getStatistics().isPresent()) { checkState(!tableDefinition.isPartitioned(), "Statisitcs are not supported for parititioned tables"); hiveThriftClient.setStatistics(tableName, tableDefinition.getDataSource().getStatistics().get()); } return new HiveTableInstance(tableName, tableDefinition); }
Source:
public void onStartup(ServletContext servletContext) throws ServletException { if(servletInitParams.isPresent()) { servletInitParams.get().getInitParams().forEach((key, value) -> servletContext.setInitParameter(key, value)); } ListenerBootstrap config = new ListenerBootstrap(servletContext); deployment = config.createDeployment(); deployment.start(); servletContext.setAttribute(ResteasyProviderFactory.class.getName(), deployment.getProviderFactory()); servletContext.setAttribute(Dispatcher.class.getName(), deployment.getDispatcher()); servletContext.setAttribute(Registry.class.getName(), deployment.getRegistry()); SpringBeanProcessor processor = new SpringBeanProcessor(deployment.getDispatcher(), deployment.getRegistry(), deployment.getProviderFactory()); processor.postProcessBeanFactory(beanFactory); applicationContext.addApplicationListener(processor); }

Target:
public void onStartup(ServletContext servletContext) throws ServletException { servletInitParams.ifPresent(params -> params.getInitParams().forEach((key, value) -> servletContext.setInitParameter(key, value))); ListenerBootstrap config = new ListenerBootstrap(servletContext); deployment = config.createDeployment(); deployment.start(); servletContext.setAttribute(ResteasyProviderFactory.class.getName(), deployment.getProviderFactory()); servletContext.setAttribute(Dispatcher.class.getName(), deployment.getDispatcher()); servletContext.setAttribute(Registry.class.getName(), deployment.getRegistry()); SpringBeanProcessor processor = new SpringBeanProcessor(deployment.getDispatcher(), deployment.getRegistry(), deployment.getProviderFactory()); processor.postProcessBeanFactory(beanFactory); applicationContext.addApplicationListener(processor); }
Source:
public void getPermissionsObjectWithChildrenTest() throws Exception { List<ContentObject> children = new ArrayList<>(); children.add(member); when(repoObjLoader.getRepositoryObject(parentPid)).thenReturn(parent); when(parent.getMembers()).thenReturn(children); when(member.getPid()).thenReturn(memberPid); when(memberPermissions.add(result)).thenReturn(true); ArrayList<Map<String, Object>> memberPerms = new ArrayList<Map<String,Object>>(); when(permResult.put("memberPermissions", memberPermissions)).thenReturn(memberPerms); when(aclFactory.getPrincipalRoles(memberPid)).thenReturn(objPrincRoles); when(aclFactory.isMarkedForDeletion(memberPid)).thenReturn(true); when(aclFactory.getEmbargoUntil(memberPid)).thenReturn(testDate); when(aclFactory.getPatronAccess(memberPid)).thenReturn(PatronAccess.authenticated); result = aclRetrievalService.getPermissions(agent, parentPid); String resultJson = generateJson(result); assertTrue(resultJson.contains("pid\":\"" + parentUuid)); assertTrue(resultJson.contains("memberPermissions")); assertTrue(resultJson.contains("markForDeletion\":false")); assertTrue(resultJson.contains("embargoed\":" + testDate.getTime())); assertTrue(resultJson.contains("patronAccess\":\"authenticated")); memberPerms.add(result); Map<String,Object> returnedValues = ((ArrayList<Map<String, Object>>) result.get("memberPermissions")).get(0); assertEquals(memberUuid, returnedValues.get("pid")); assertEquals(objPrincRoles, returnedValues.get("principals")); assertEquals(true, returnedValues.get("markForDeletion")); assertEquals(testDate, returnedValues.get("embargoed")); assertEquals(PatronAccess.authenticated, returnedValues.get("patronAccess")); }

Target:
public void getPermissionsObjectWithChildrenTest() throws Exception { List<ContentObject> children = new ArrayList<>(); children.add(member); when(repoObjLoader.getRepositoryObject(parentPid)).thenReturn(parent); when(parent.getMembers()).thenReturn(children); when(member.getPid()).thenReturn(memberPid); when(memberPermissions.add(result)).thenReturn(true); when(objAclFactory.getEmbargoUntil(parentPid)).thenReturn(null); when(objAclFactory.getEmbargoUntil(memberPid)).thenReturn(testDate); when(inheritedAclFactory.getEmbargoUntil(any(PID.class))).thenReturn(null); result = aclRetrievalService.getPermissions(agent, parentPid); assertEquals(parentUuid, result.get("pid")); assertEquals(false, result.get("markForDeletion")); assertNull(result.get("embargo")); assertEquals(objPrincRoles, result.get("principals")); assertEquals(PatronAccess.authenticated, result.get("patronAccess")); assertTrue(result.containsKey("memberPermissions")); Map<String,Object> memberValues = ((List<Map<String, Object>>) result.get("memberPermissions")).get(0); assertEquals(memberUuid, memberValues.get("pid")); assertEquals(false, memberValues.get("markForDeletion")); assertEquals(testDate, memberValues.get("embargo")); assertEquals(objPrincRoles, memberValues.get("principals")); assertEquals(PatronAccess.authenticated, memberValues.get("patronAccess")); }
Source:
public static ArrayList<Long> getPendingDraftsIgnorePostIdList() { ArrayList<Long> idList = new ArrayList<>(); String idListString = getString(DeletablePrefKey.PENDING_DRAFTS_NOTIFICATION_IGNORE_LIST, ""); if (!TextUtils.isEmpty(idListString)) { List<String> items = Arrays.asList(idListString.split("\\s*,\\s*")); for (String item : items) { Long oneId = Long.valueOf(item); idList.add(oneId); } } return idList; }

Target:
public static ArrayList<Long> getPendingDraftsIgnorePostIdList() { ArrayList<Long> idList = new ArrayList<>(); String idListString = getString(DeletablePrefKey.PENDING_DRAFTS_NOTIFICATION_IGNORE_LIST, ""); if (!TextUtils.isEmpty(idListString)) { List<String> items = Arrays.asList(idListString.split(",")); for (String item : items) { Long oneId = Long.valueOf(item); idList.add(oneId); } } return idList; }
Source:
public void showToast(String message, ToastUtil.ToastType toastType) { if (getActivity() != null) ToastUtil.showShortToast(getActivity(), toastType, message); }

Target:
public void showToast(String message, ToastUtil.ToastType toastType) { if (getActivity() != null) { ToastUtil.showShortToast(getActivity(), toastType, message); } }
Source:
public void onNext(Object t) { if (get() != SubscriptionHelper.CANCELLED) { get().cancel(); lazySet(SubscriptionHelper.CANCELLED); parent.onTimeout(idx); } }

Target:
public void onNext(Object t) { Subscription upstream = get(); if (upstream != SubscriptionHelper.CANCELLED) { upstream.cancel(); lazySet(SubscriptionHelper.CANCELLED); parent.onTimeout(idx); } }
Source:
protected ProducerConfig createKafkaProducerConfig(){ if(brokerList != null) { getConfigProperties().setProperty(BROKER_KEY, brokerList); } getConfigProperties().setProperty(BATCH_NUM_KEY, String.valueOf(batchSize)); producerConfig = super.createKafkaProducerConfig(); return producerConfig; }

Target:
protected ProducerConfig createKafkaProducerConfig() { if (brokerList != null) { getConfigProperties().setProperty(BROKER_KEY, brokerList); } if (isBatchProcessing) { if (batchSize != 0) { getConfigProperties().setProperty(BATCH_NUM_KEY, String.valueOf(batchSize)); } getConfigProperties().setProperty(PRODUCER_KEY, ASYNC_PRODUCER_TYPE); } return super.createKafkaProducerConfig(); }
Source:
@Override public Pair<RelTraitSet, List<RelTraitSet>> passThroughTraits( RelTraitSet required) { RelCollation collation = required.getTrait(RelCollationTraitDef.INSTANCE); if (collation == null || collation.getFieldCollations().size() == 0) { return null; } return Pair.of(required, ImmutableList.of(required)); }

Target:
@Override public Pair<RelTraitSet, List<RelTraitSet>> passThroughTraits( RelTraitSet required) { if (required.getCollation() == null || required.isDefaultSansConvention()) { return null; } RelCollation collation = required.getCollation(); RelTraitSet traits = traitSet.replace(collation); return Pair.of(traits, ImmutableList.of(traits)); }
Source:
public RefundEntityFixture withUserExternalId(String userExternalId) { RefundEntityFixture.userExternalId = userExternalId; return this; }

Target:
public RefundEntityFixture withUserExternalId(String userExternalId) { this.userExternalId = userExternalId; return this; }
Source:
public void testLoadOpportunityMRUObjectsFromCache() throws Exception { final List<SalesforceObject> mruObjects_before = metadataManager.loadMRUObjects(Constants.OPPORTUNITY, MAX_QUERY_LIMIT, CachePolicy.RELOAD_AND_RETURN_CACHE_DATA, REFRESH_INTERVAL, null); Map<String, String> idToNames = new HashMap<String, String>(); int numberOfRecords = 1; idToNames = createRecordsOnServer(1, Constants.OPPORTUNITY); String[] names = idToNames.values().toArray(new String[1]);; String[] ids = idToNames.keySet().toArray(new String[1]); try { Thread.sleep(2000); final List<SalesforceObject> mruObjects = metadataManager.loadMRUObjects(Constants.OPPORTUNITY, MAX_QUERY_LIMIT, CachePolicy.RETURN_CACHE_DATA_DONT_RELOAD, REFRESH_INTERVAL, null); assertNotNull("MRU list should not be null", mruObjects); assertEquals("MRU list size should not be changed", mruObjects_before.size(), mruObjects.size()); assertEquals("Recently viewed object name is incorrect", mruObjects_before.get(0).getName(), mruObjects.get(0).getName()); } finally { deleteRecordsOnServer(ids, Constants.OPPORTUNITY); } }

Target:
public void testLoadOpportunityMRUObjectsFromCache() throws Exception { final List<SalesforceObject> mruObjects_before = metadataManager.loadMRUObjects(Constants.OPPORTUNITY, MAX_QUERY_LIMIT, CachePolicy.RELOAD_AND_RETURN_CACHE_DATA, REFRESH_INTERVAL, null); int numberOfRecords = 1; Map<String, String> idToNames = createRecordsOnServer(1, Constants.OPPORTUNITY); Set<String> ids = idToNames.keySet(); try { Thread.sleep(2000); final List<SalesforceObject> mruObjects = metadataManager.loadMRUObjects(Constants.OPPORTUNITY, MAX_QUERY_LIMIT, CachePolicy.RETURN_CACHE_DATA_DONT_RELOAD, REFRESH_INTERVAL, null); assertNotNull("MRU list should not be null", mruObjects); assertEquals("MRU list size should not be changed", mruObjects_before.size(), mruObjects.size()); assertEquals("Recently viewed object name is incorrect", mruObjects_before.get(0).getName(), mruObjects.get(0).getName()); } finally { deleteRecordsOnServer(ids, Constants.OPPORTUNITY); } }
Source:
private Set<String> buildResourceNames() { Set<String> retval = new HashSet<>(); Properties props = new Properties(); try { props.load(myVersion.getFhirVersionPropertiesFile()); } catch (IOException theE) { throw new ConfigurationException("Failed to load version properties file"); } Enumeration<?> propNames = props.propertyNames(); while (propNames.hasMoreElements()) { String next = (String) propNames.nextElement(); if (next.startsWith("resource.")) { retval.add(next.substring("resource.".length()).trim()); } } return retval; }

Target:
private Set<String> buildResourceNames() { Set<String> retVal = new HashSet<>(); Properties props = new Properties(); try (InputStream propFile = myVersion.getFhirVersionPropertiesFile()) { props.load(propFile); } catch (IOException e) { throw new ConfigurationException("Failed to load version properties file", e); } Enumeration<?> propNames = props.propertyNames(); while (propNames.hasMoreElements()) { String next = (String) propNames.nextElement(); if (next.startsWith("resource.")) { retVal.add(next.substring("resource.".length()).trim()); } } return retVal; }
Source:
private void sortPropertyMappingsByDependencies() { final GraphAnalyzer graphAnalyzer = new GraphAnalyzer(); for ( PropertyMapping propertyMapping : propertyMappings ) { graphAnalyzer.addNode( propertyMapping.getName(), propertyMapping.getDependsOn() ); } graphAnalyzer.analyze(); if ( !graphAnalyzer.getCycles().isEmpty() ) { Set<String> cycles = new HashSet<String>( graphAnalyzer.getCycles().size() ); for ( List<String> cycle : graphAnalyzer.getCycles() ) { cycles.add( Strings.join( cycle, " -> " ) ); } ctx.getMessager().printMessage( method.getExecutable(), Message.BEANMAPPING_CYCLE_BETWEEN_PROPERTIES, Strings.join( cycles, ", " ) ); } else { Collections.sort( propertyMappings, new Comparator<PropertyMapping>() { @Override public int compare(PropertyMapping o1, PropertyMapping o2) { if ( graphAnalyzer.getAllDescendants( o1.getName() ).contains( o2.getName() ) ) { return 1; } else if ( graphAnalyzer.getAllDescendants( o2.getName() ).contains( o1.getName() ) ) { return -1; } else { return 0; } } } ); } }

Target:
private void sortPropertyMappingsByDependencies() { GraphAnalyzerBuilder graphAnalyzerBuilder = GraphAnalyzer.builder(); for ( PropertyMapping propertyMapping : propertyMappings ) { graphAnalyzerBuilder.withNode( propertyMapping.getName(), propertyMapping.getDependsOn() ); } final GraphAnalyzer graphAnalyzer = graphAnalyzerBuilder.build(); if ( !graphAnalyzer.getCycles().isEmpty() ) { Set<String> cycles = new HashSet<String>(); for ( List<String> cycle : graphAnalyzer.getCycles() ) { cycles.add( Strings.join( cycle, " -> " ) ); } ctx.getMessager().printMessage( method.getExecutable(), Message.BEANMAPPING_CYCLE_BETWEEN_PROPERTIES, Strings.join( cycles, ", " ) ); } else { Collections.sort( propertyMappings, new Comparator<PropertyMapping>() { @Override public int compare(PropertyMapping o1, PropertyMapping o2) { if ( graphAnalyzer.getAllDescendants( o1.getName() ).contains( o2.getName() ) ) { return 1; } else if ( graphAnalyzer.getAllDescendants( o2.getName() ).contains( o1.getName() ) ) { return -1; } else { return 0; } } } ); } }
Source:
public void update() { final Map<String, TreeItem> fNodes = new HashMap<>(); final Map<TreeItem, ArrayList<Path>> fChildren = new HashMap<>(); fTree.removeAll(); Path path = Paths.get(fXmlFilesPath.toString()); try { Files.walkFileTree(path, new SimpleFileVisitor<Path>() { @Override public FileVisitResult preVisitDirectory(Path dir, BasicFileAttributes attrs) { TreeItem itemParent = fNodes.get(dir.getParent().toString()); TreeItem item = null; if (itemParent == null) { item = new TreeItem(fTree, SWT.NONE); } else { item = new TreeItem(itemParent, SWT.NONE); } item.setText(dir.getFileName().toString()); fItemsPaths.put(item, dir); fNodes.put(dir.toString(), item); return FileVisitResult.CONTINUE; } @Override public FileVisitResult visitFile(Path dir, BasicFileAttributes attrs) { TreeItem itemParent = fNodes.get(dir.getParent().toString()); if (fChildren.get(itemParent) == null) { fChildren.put(itemParent, new ArrayList<Path>()); } fChildren.get(itemParent).add(dir); return FileVisitResult.CONTINUE; } }); } catch (IOException e) { Activator.logError("Cannot walk through the XML Files directory!", e); } for (TreeItem p : fChildren.keySet()) { for (Path c : fChildren.get(p)) { TreeItem item = new TreeItem(p, SWT.NONE); fItemsPaths.put(item, c); item.setText(c.getFileName().toString()); } } fTree.layout(); }

Target:
public void update() { final Map<String, TreeItem> Nodes = new HashMap<>(); final Map<TreeItem, ArrayList<Path>> Children = new HashMap<>(); fTree.removeAll(); Path path = Paths.get(fXmlFilesPath.toString()); try { Files.walkFileTree(path, new SimpleFileVisitor<Path>() { @Override public FileVisitResult preVisitDirectory(Path dir, BasicFileAttributes attrs) { TreeItem itemParent = Nodes.get(dir.getParent().toString()); TreeItem item = null; if (itemParent == null) { item = new TreeItem(fTree, SWT.NONE); } else { item = new TreeItem(itemParent, SWT.NONE); } item.setText(dir.getFileName().toString()); fItemsPaths.put(item, dir); Nodes.put(dir.toString(), item); return FileVisitResult.CONTINUE; } @Override public FileVisitResult visitFile(Path dir, BasicFileAttributes attrs) { TreeItem itemParent = Nodes.get(dir.getParent().toString()); if (Children.get(itemParent) == null) { Children.put(itemParent, new ArrayList<Path>()); } Children.get(itemParent).add(dir); return FileVisitResult.CONTINUE; } }); } catch (IOException e) { Activator.logError("Cannot walk through the XML Files directory!", e); } for (TreeItem p : Children.keySet()) { for (Path c : Children.get(p)) { TreeItem item = new TreeItem(p, SWT.NONE); fItemsPaths.put(item, c); item.setText(c.getFileName().toString()); } } fTree.layout(); }
Source:
public void start() { components.forEach(component -> { log.info("calling publishInfo on ", component); component.publishInfo(componentInfoPublisher); }); componentInfoPublisher.startupFinished(); components.forEach(component -> component.start()); }

Target:
public void start() { components.forEach(component -> { if (log.isDebugEnabled()) { log.debug("calling publishInfo on ", component); } component.publishInfo(componentInfoPublisher); }); componentInfoPublisher.startupFinished(); components.forEach(component -> component.start()); }
Source:
String toString(Binary value) { return value.toStringUsingUTF8(); }

Target:
String toString(Binary value) { return value == null ? "null" : value.toStringUsingUTF8(); }
Source:
NendUnifiedNativeNormalAdMapper( Context context, NendNativeAdForwarder forwarder, NendAdNative ad, NendNativeMappedImage adImage, NendNativeMappedImage logoImage) { super(logoImage); this.forwarder = forwarder; nendAd = ad; connector = NativeAdLoader.createNativeAdConnector(ad); setAdvertiser(ad.getPromotionName()); setHeadline(ad.getTitleText()); setBody(ad.getContentText()); setCallToAction(ad.getActionText()); if (adImage != null) { List<NativeAd.Image> imagesList = new ArrayList<>(); imagesList.add(adImage); setImages(imagesList); Drawable drawable = adImage.getDrawable(); if (drawable != null) { ImageView imageView = new ImageView(context); imageView.setAdjustViewBounds(true); imageView.setImageDrawable(drawable); setMediaView(imageView); } } adChoicesMappingView = new TextView(context); adChoicesMappingView.setText(NendAdNative.AdvertisingExplicitly.PR.getText()); setAdChoicesContent(adChoicesMappingView); nendAd.setNendAdNativeListener(this); }

Target:
NendUnifiedNativeNormalAdMapper( Context context, NendNativeAdForwarder forwarder, NendAdNative ad, NendNativeMappedImage adImage, NendNativeMappedImage logoImage) { super(logoImage); this.forwarder = forwarder; nendAd = ad; connector = NendNativeAdConnectorFactory.createNativeAdConnector(ad); setAdvertiser(ad.getPromotionName()); setHeadline(ad.getTitleText()); setBody(ad.getContentText()); setCallToAction(ad.getActionText()); ImageView imageView = new ImageView(context); if (adImage == null) { Log.w(TAG, "Missing Image of nend's native ad, so MediaView will be unavailable..."); } else { List<NativeAd.Image> imagesList = new ArrayList<>(); imagesList.add(adImage); setImages(imagesList); Drawable drawable = adImage.getDrawable(); if (drawable != null) { imageView.setAdjustViewBounds(true); imageView.setImageDrawable(drawable); } } setMediaView(imageView); adChoicesMappingView = new TextView(context); adChoicesMappingView.setText(NendAdNative.AdvertisingExplicitly.PR.getText()); setAdChoicesContent(adChoicesMappingView); nendAd.setNendAdNativeListener(this); }
Source:
public DataSourceMetadata minus(DataSourceMetadata other) { if (!(other instanceof KafkaDataSourceMetadata)) { throw new IAE( "Expected instance of %s, got %s", KafkaDataSourceMetadata.class.getCanonicalName(), other.getClass().getCanonicalName() ); } final KafkaDataSourceMetadata that = (KafkaDataSourceMetadata) other; if (that.getKafkaPartitions().getTopic().equals(kafkaPartitions.getTopic())) { final Map<Integer, Long> newMap = Maps.newHashMap(); for (Map.Entry<Integer, Long> entry : kafkaPartitions.getPartitionOffsetMap().entrySet()) { newMap.put(entry.getKey(), entry.getValue()); } for (Map.Entry<Integer, Long> entry : that.getKafkaPartitions().getPartitionOffsetMap().entrySet()) { newMap.remove(entry.getKey()); } return new KafkaDataSourceMetadata(new KafkaPartitions(kafkaPartitions.getTopic(), newMap)); } else { return this; } }

Target:
public DataSourceMetadata minus(DataSourceMetadata other) { if (!(other instanceof KafkaDataSourceMetadata)) { throw new IAE( "Expected instance of %s, got %s", KafkaDataSourceMetadata.class.getCanonicalName(), other.getClass().getCanonicalName() ); } final KafkaDataSourceMetadata that = (KafkaDataSourceMetadata) other; if (that.getKafkaPartitions().getTopic().equals(kafkaPartitions.getTopic())) { final Map<Integer, Long> newMap = Maps.newHashMap(); for (Map.Entry<Integer, Long> entry : kafkaPartitions.getPartitionOffsetMap().entrySet()) { if(!that.getKafkaPartitions().getPartitionOffsetMap().containsKey(entry.getKey())) { newMap.put(entry.getKey(), entry.getValue()); } } return new KafkaDataSourceMetadata(new KafkaPartitions(kafkaPartitions.getTopic(), newMap)); } else { return this; } }
Source:
public void test008() { this.runNegativeTest( new String[] { "X.java", "interface I {\n" + " void doit();\n" + " default void doitalso () {}\n" + "}\n" + "interface J {\n" + " void doit();\n" + " default void doitalso () {}\n" + "}\n" + "public class X {\n" + " Object p = (@Marker java.lang. @Readonly String & I & J) () -> {};\n" + "}\n" , }, "----------\n" + "1. ERROR in X.java (at line 10)\n" + " Object p = (@Marker java.lang. @Readonly String & I & J) () -> {};\n" + " ^^^^^^^\n" + "The annotation @Marker is disallowed for this location - type annotations must be placed directly before the type name (within the qualified name)\n" + "----------\n" + "2. ERROR in X.java (at line 10)\n" + " Object p = (@Marker java.lang. @Readonly String & I & J) () -> {};\n" + " ^^^^^^\n" + "Marker cannot be resolved to a type\n" + "----------\n" + "3. ERROR in X.java (at line 10)\n" + " Object p = (@Marker java.lang. @Readonly String & I & J) () -> {};\n" + " ^^^^^^^^\n" + "Readonly cannot be resolved to a type\n" + "----------\n" + "4. ERROR in X.java (at line 10)\n" + " Object p = (@Marker java.lang. @Readonly String & I & J) () -> {};\n" + " ^^^^^\n" + "The target type of this expression must be a functional interface\n" + "----------\n"); }

Target:
public void test008() { this.runNegativeTest( new String[] { "X.java", "interface I {\n" + " void doit();\n" + " default void doitalso () {}\n" + "}\n" + "interface J {\n" + " void doit();\n" + " default void doitalso () {}\n" + "}\n" + "public class X {\n" + " Object p = (@Marker java.lang. @Readonly String & I & J) () -> {};\n" + "}\n" , }, "----------\n" + "1. ERROR in X.java (at line 10)\n" + " Object p = (@Marker java.lang. @Readonly String & I & J) () -> {};\n" + " ^^^^^^^\n" + "Illegally placed annotation: type annotations must directly precede the simple name of the type they are meant to affect (or the for arrays)\n" + "----------\n" + "2. ERROR in X.java (at line 10)\n" + " Object p = (@Marker java.lang. @Readonly String & I & J) () -> {};\n" + " ^^^^^^\n" + "Marker cannot be resolved to a type\n" + "----------\n" + "3. ERROR in X.java (at line 10)\n" + " Object p = (@Marker java.lang. @Readonly String & I & J) () -> {};\n" + " ^^^^^^^^\n" + "Readonly cannot be resolved to a type\n" + "----------\n" + "4. ERROR in X.java (at line 10)\n" + " Object p = (@Marker java.lang. @Readonly String & I & J) () -> {};\n" + " ^^^^^\n" + "The target type of this expression must be a functional interface\n" + "----------\n"); }
Source:
public CompletableFuture<HermesResponse> send(URI uri, HermesMessage message) { String prefix = "hermes-client." + message.getSanitizedTopic(); Timer.Context ctx = metrics.timer(prefix + ".latency").time(); return sender.send(uri, message).whenComplete((resp, cause) -> { ctx.close(); if (resp != null) { metrics.counter(prefix + ".status." + resp.getHttpStatus()).inc(); } if (cause != null) { metrics.counter(prefix + ".exception." + cause.getClass().getSimpleName()).inc(); } }); }

Target:
public CompletableFuture<HermesResponse> send(URI uri, HermesMessage message) { String prefix = "hermes-client." + message.getSanitizedTopic(); Timer.Context ctx = metrics.timer(prefix + ".latency").time(); return sender.send(uri, message).whenComplete((resp, cause) -> { ctx.close(); if (resp != null) { metrics.counter(prefix + ".status." + resp.getHttpStatus()).inc(); } if (cause != null) { metrics.counter(prefix + ".failure").inc(); } }); }
Source:
public void SDKHeaderIsIncludedInGetCalls() throws Exception { new Thread(new Runnable() { @Override public void run() { OneSignalRestClient.getSync("URL", null, null); } }, OS_REST_CLIENT).start(); threadAndTaskWait(); assertEquals(SDK_VERSION_HTTP_HEADER, getLastHTTPHeaderProp("SDK-Version")); }

Target:
public void SDKHeaderIsIncludedInGetCalls() throws Exception { OneSignalRestClient.get("URL", null, null); threadAndTaskWait(); assertEquals(SDK_VERSION_HTTP_HEADER, getLastHTTPHeaderProp("SDK-Version")); }
Source:
public static OptionSet discardEOptions(OptionSet optionSet){ OptionSet result = new OptionSet(); boolean discard = false; for(Option opt : optionSet.asSortedList()){ Iterator<Integer> it = allEOptions.iterator(); while(!discard && it.hasNext()){ int tmp = it.next().intValue() - opt.getNumber(); if(tmp == 0){ discard = true; } } if(!discard){ result.addOption(opt); } discard = false; } return result; }

Target:
public static OptionSet discardEOptions(OptionSet optionSet) { OptionSet result = new OptionSet(); for (Option opt : optionSet.asSortedList()) { if (!allEOptions.contains(opt.getNumber())) { result.addOption(opt); } } return result; }
Source:
public boolean addCredit(int creditDeltas) { numCreditsAvailable += creditDeltas; return shouldAnnounceBacklog(); }

Target:
public void addCredit(int creditDeltas) throws Exception { numCreditsAvailable += creditDeltas; requestQueue.enqueueAvailableReader(this, this::isAvailable); }
Source:
default Method resolveMethod(ProviderContext context) { List<Method> targetMethods = Arrays.stream(getClass().getMethods()) .filter(m -> m.getName().equals(context.getMapperMethod().getName())) .filter(m -> CharSequence.class.isAssignableFrom(m.getReturnType())) .collect(Collectors.toList()); if (targetMethods.size() == 1) { return targetMethods.get(0); } if (targetMethods.isEmpty()) { throw new BuilderException("Cannot resolve the provide method because '" + context.getMapperMethod().getName() + "' not found in SqlProvider '" + getClass().getName() + "'."); } else { throw new BuilderException("Cannot resolve the provide method because '" + context.getMapperMethod().getName() + "' is found multiple in SqlProvider '" + getClass().getName() + "'."); } }

Target:
default Method resolveMethod(ProviderContext context) { List<Method> sameNameMethods = Arrays.stream(getClass().getMethods()) .filter(m -> m.getName().equals(context.getMapperMethod().getName())) .collect(Collectors.toList()); if (sameNameMethods.isEmpty()) { throw new BuilderException("Cannot resolve the provider method because '" + context.getMapperMethod().getName() + "' not found in SqlProvider '" + getClass().getName() + "'."); } List<Method> targetMethods = sameNameMethods.stream() .filter(m -> CharSequence.class.isAssignableFrom(m.getReturnType())) .collect(Collectors.toList()); if (targetMethods.size() == 1) { return targetMethods.get(0); } if (targetMethods.isEmpty()) { throw new BuilderException("Cannot resolve the provider method because '" + context.getMapperMethod().getName() + "' does not return the CharSequence or its subclass in SqlProvider '" + getClass().getName() + "'."); } else { throw new BuilderException("Cannot resolve the provider method because '" + context.getMapperMethod().getName() + "' is found multiple in SqlProvider '" + getClass().getName() + "'."); } }
Source:
public void configure(Binder binder) { binder.bind(Key.get(Log4jShutterDowner.class, Names.named("ForTheEagerness"))) .to(Log4jShutterDowner.class) .asEagerSingleton(); }

Target:
public void configure(Binder binder) { try { final Class<?> logManagerClazz = Class.forName("org.apache.logging.log4j.LogManager"); final LoggerContextFactory contextFactory = LogManager.getFactory(); if (!(contextFactory instanceof Log4jContextFactory)) { log.warn( "Expected [%s] found [%s]. Unknown class for context factory. Not logging shutdown", Log4jContextFactory.class.getCanonicalName(), contextFactory.getClass().getCanonicalName() ); return; } final ShutdownCallbackRegistry registry = ((Log4jContextFactory) contextFactory).getShutdownCallbackRegistry(); if (!(registry instanceof Log4jShutdown)) { log.warn( "Shutdown callback registry expected class [%s] found [%s]. Skipping shutdown registry", Log4jShutdown.class.getCanonicalName(), registry.getClass().getCanonicalName() ); return; } binder.bind(Log4jShutdown.class).toInstance((Log4jShutdown) registry); binder.bind(Key.get(Log4jShutterDowner.class, Names.named("ForTheEagerness"))) .to(Log4jShutterDowner.class) .asEagerSingleton(); } catch (ClassNotFoundException | ClassCastException | LinkageError e) { log.warn(e, "Not registering log4j shutdown hooks. Not using log4j?"); } }
Source:
public void write(DataOutput out) throws IOException { serialize(); byte hasValues = (values == null) ? 0 : (byte) 1; if (!replicationSources.isEmpty()) { hasValues = (byte) (0x02 | hasValues); } out.write((byte) (0x80 | hasValues)); int size = UnsynchronizedBuffer.writeVInt(integerBuffer, 0, row.length); out.write(integerBuffer, 0, size); out.write(row); size = UnsynchronizedBuffer.writeVInt(integerBuffer, 0, data.length); out.write(integerBuffer, 0, size); out.write(data); size = UnsynchronizedBuffer.writeVInt(integerBuffer, 0, entries); out.write(integerBuffer, 0, size); if (0x01 == (0x01 & hasValues)) { size = UnsynchronizedBuffer.writeVInt(integerBuffer, 0, values.size()); out.write(integerBuffer, 0, size); for (byte[] val : values) { size = UnsynchronizedBuffer.writeVInt(integerBuffer, 0, val.length); out.write(integerBuffer, 0, size); out.write(val); } } if (0x02 == (0x02 & hasValues)) { size = UnsynchronizedBuffer.writeVInt(integerBuffer, 0, replicationSources.size()); out.write(integerBuffer, 0, size); for (String source : replicationSources) { WritableUtils.writeString(out, source); } } }

Target:
public void write(DataOutput out) throws IOException { final byte[] integerBuffer = new byte[5]; serialize(); byte hasValues = (values == null) ? 0 : (byte) 1; if (!replicationSources.isEmpty()) { hasValues = (byte) (0x02 | hasValues); } out.write((byte) (0x80 | hasValues)); UnsynchronizedBuffer.writeVInt(out, integerBuffer, row.length); out.write(row); UnsynchronizedBuffer.writeVInt(out, integerBuffer, data.length); out.write(data); UnsynchronizedBuffer.writeVInt(out, integerBuffer, entries); if (0x01 == (0x01 & hasValues)) { UnsynchronizedBuffer.writeVInt(out, integerBuffer, values.size()); for (byte[] val : values) { UnsynchronizedBuffer.writeVInt(out, integerBuffer, val.length); out.write(val); } } if (0x02 == (0x02 & hasValues)) { UnsynchronizedBuffer.writeVInt(out, integerBuffer, replicationSources.size()); for (String source : replicationSources) { WritableUtils.writeString(out, source); } } }
Source:
protected HttpResponse invoke(HttpURLConnection connection) throws IOException, InterruptedException { HttpResponse original = super.invoke(connection); HttpResponse.Builder<?> response = original.toBuilder(); if (hasPayload(original)) { InputStream in = null; InputStream originalInputStream = original.getPayload().openStream(); if (originalInputStream instanceof ByteArrayInputStream) { in = originalInputStream; } else { try { in = new ByteArrayInputStream(ByteStreams.toByteArray(originalInputStream)); } finally { close(originalInputStream, true); } } BaseResponse responseContent = errorParser.apply(in); if (responseContent != null && responseContent.getStatus() == Status.ERROR) { if (ACCESS_DENIED.equals(responseContent.getMessage())) { response.statusCode(401); } else if (NOT_FOUND.equals(responseContent.getMessage())) { response.statusCode(404); } else { response.statusCode(500); } response.message(responseContent.getDetails()); } in.reset(); Payload payload = newInputStreamPayload(in); contentMetadataCodec.fromHeaders(payload.getContentMetadata(), original.getHeaders()); response.payload(payload); } return response.build(); }

Target:
protected HttpResponse invoke(HttpURLConnection connection) throws IOException, InterruptedException { HttpResponse original = super.invoke(connection); HttpResponse.Builder<?> response = original.toBuilder(); if (hasPayload(original)) { InputStream in = null; InputStream originalInputStream = original.getPayload().openStream(); if (originalInputStream instanceof ByteArrayInputStream) { in = originalInputStream; } else { try { in = new ByteArrayInputStream(ByteStreams.toByteArray(originalInputStream)); } finally { close(originalInputStream, true); } } BaseResponse responseContent = errorParser.apply(in); if (responseContent != null && responseContent.getStatus() == Status.ERROR) { String message = responseContent.getMessage(); if (ACCESS_DENIED.equals(message)) { response.statusCode(401); } else if (NOT_FOUND.equals(message)) { response.statusCode(404); } else { response.statusCode(500); } response.message(responseContent.getDetails()); } in.reset(); Payload payload = newInputStreamPayload(in); contentMetadataCodec.fromHeaders(payload.getContentMetadata(), original.getHeaders()); response.payload(payload); } return response.build(); }
Source:
public final void runDevicePreInvocationSetup( IInvocationContext context, IConfiguration config, ITestLogger logger) throws DeviceNotAvailableException, TargetSetupError { if (mPreInvocationSetupDone) { return; } for (String deviceName : context.getDeviceConfigNames()) { ITestDevice device = context.getDevice(deviceName); CLog.d("Starting device pre invocation setup for : '%s'", device.getSerialNumber()); if (device instanceof ITestLoggerReceiver) { ((ITestLoggerReceiver) context.getDevice(deviceName)).setTestLogger(logger); } if (!config.getCommandOptions().shouldSkipPreDeviceSetup()) { device.preInvocationSetup(context.getBuildInfo(deviceName)); } } mPreInvocationSetupDone = true; }

Target:
public final void runDevicePreInvocationSetup( IInvocationContext context, IConfiguration config, ITestLogger logger) throws DeviceNotAvailableException, TargetSetupError { for (String deviceName : context.getDeviceConfigNames()) { ITestDevice device = context.getDevice(deviceName); CLog.d("Starting device pre invocation setup for : '%s'", device.getSerialNumber()); if (device instanceof ITestLoggerReceiver) { ((ITestLoggerReceiver) context.getDevice(deviceName)).setTestLogger(logger); } if (!config.getCommandOptions().shouldSkipPreDeviceSetup()) { device.preInvocationSetup(context.getBuildInfo(deviceName)); } } }
Source:
private static ICPPEvaluation callFunction(ICPPClassType classType, ICPPFunction func, ICPPEvaluation rangeEval, ActivationRecord record, ConstexprEvaluationContext context) { EvalFunctionCall call = null; if(func instanceof ICPPMethod) { EvalMemberAccess memberAccess = new EvalMemberAccess(classType, ValueCategory.LVALUE, func, rangeEval, false, context.getPoint()); ICPPEvaluation[] args = new ICPPEvaluation[]{ memberAccess }; call = new EvalFunctionCall(args, rangeEval, context.getPoint()); } else { ICPPASTName name = new CPPASTName(func.getNameCharArray()); name.setBinding(func); IASTIdExpression idExpr = new CPPASTIdExpression(name); ICPPEvaluation op = EvalID.create(idExpr); ICPPEvaluation[] args = new ICPPEvaluation[]{ op, rangeEval}; call = new EvalFunctionCall(args, null, context.getPoint()); } return call.computeForFunctionCall(record, context); }

Target:
private static ICPPEvaluation callFunction(ICPPClassType classType, ICPPFunction func, ICPPEvaluation rangeEval, ActivationRecord record, ConstexprEvaluationContext context) { EvalFunctionCall call = null; if(func instanceof ICPPMethod) { EvalMemberAccess memberAccess = new EvalMemberAccess(classType, ValueCategory.LVALUE, func, rangeEval, false, context.getPoint()); ICPPEvaluation[] args = new ICPPEvaluation[]{ memberAccess }; call = new EvalFunctionCall(args, rangeEval, context.getPoint()); } else { EvalBinding op = new EvalBinding(func, func.getType(), context.getPoint()); ICPPEvaluation[] args = new ICPPEvaluation[]{ op, rangeEval}; call = new EvalFunctionCall(args, null, context.getPoint()); } return call.computeForFunctionCall(record, context); }
Source:
public final void mID() throws RecognitionException { try { int _type = ID; int _channel = DEFAULT_TOKEN_CHANNEL; { if ((input.LA(1) >= 'A' && input.LA(1) <= 'Z') || (input.LA(1) >= 'a' && input.LA(1) <= 'z') || input.LA( 1) == '(' || input.LA(1) == ')') { input.consume(); } else { MismatchedSetException mse = new MismatchedSetException(null, input); recover(mse); throw mse; } loop1: do { int alt1 = 2; int LA1_0 = input.LA(1); if ((LA1_0 == ' ' || LA1_0 == '-' || (LA1_0 >= '0' && LA1_0 <= '9') || (LA1_0 >= 'A' && LA1_0 <= 'Z') || LA1_0 == '_' || input.LA( 1) == '(' || input.LA(1) == ')' || (LA1_0 >= 'a' && LA1_0 <= 'z'))) { alt1 = 1; } switch (alt1) { case 1: { if (input.LA(1) == ' ' || input.LA( 1) == '-' || (input.LA(1) >= '0' && input.LA(1) <= '9') || (input.LA( 1) >= 'A' && input.LA(1) <= 'Z') || input.LA( 1) == '_' || (input.LA(1) >= 'a' && input.LA(1) <= 'z') || input.LA( 1) == '(' || input.LA(1) == ')') { input.consume(); } else { MismatchedSetException mse = new MismatchedSetException(null, input); recover(mse); throw mse; } } break; default: break loop1; } } while (true); } state.type = _type; state.channel = _channel; } finally { } }

Target:
public final void mID() throws RecognitionException { try { int _type = ID; int _channel = DEFAULT_TOKEN_CHANNEL; { if ((input.LA(1) >= 'A' && input.LA(1) <= 'Z') || (input.LA(1) >= 'a' && input.LA(1) <= 'z')) { input.consume(); } else { MismatchedSetException mse = new MismatchedSetException(null, input); recover(mse); throw mse; } loop1: do { int alt1 = 2; int LA1_0 = input.LA(1); if ((LA1_0 == ' ' || (LA1_0 >= '(' && LA1_0 <= ')') || LA1_0 == '-' || (LA1_0 >= '0' && LA1_0 <= '9') || (LA1_0 >= 'A' && LA1_0 <= 'Z') || LA1_0 == '_' || (LA1_0 >= 'a' && LA1_0 <= 'z'))) { alt1 = 1; } switch (alt1) { case 1: { if (input.LA(1) == ' ' || (input.LA(1) >= '(' && input.LA(1) <= ')') || input.LA( 1) == '-' || (input.LA(1) >= '0' && input.LA(1) <= '9') || (input.LA( 1) >= 'A' && input.LA(1) <= 'Z') || input.LA( 1) == '_' || (input.LA(1) >= 'a' && input.LA(1) <= 'z')) { input.consume(); } else { MismatchedSetException mse = new MismatchedSetException(null, input); recover(mse); throw mse; } } break; default: break loop1; } } while (true); } state.type = _type; state.channel = _channel; } finally { } }
Source:
public DataRecord getRecordFromReference(String reference) throws DataStoreException { return null; }

Target:
public DataRecord getRecordFromReference(String reference) throws DataStoreException { Iterator<DataStore> iter = delegateHandler.getAllDelegatesIterator(); while (iter.hasNext()) { DataStore ds = iter.next(); DataRecord rec = ds.getRecordFromReference(reference); if (null != rec) { return rec; } } return null; }