auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
private IStatus handleWorkspaceRootDrop(DropTargetEvent event) { if (event.data instanceof IStructuredSelection) { IStructuredSelection selection = (IStructuredSelection) event.data; if (onlyRepositoryNodesSelected(selection)) { List<String> reposToRemove = new ArrayList<>(); for (Object treeNode : selection.toList()) { RepositoryNode repo = (RepositoryNode) treeNode; reposToRemove.add( repo.getRepository().getDirectory().toString()); } RepositoryGroups groups = new RepositoryGroups(); groups.removeFromGroups(reposToRemove); refreshRepositoriesView(); return Status.OK_STATUS; } } return Status.CANCEL_STATUS; }

Target:
private IStatus handleWorkspaceRootDrop(DropTargetEvent event) { if (event.data instanceof IStructuredSelection) { IStructuredSelection selection = (IStructuredSelection) event.data; if (onlyRepositoryNodesSelected(selection)) { List<File> reposToRemove = new ArrayList<>(); for (Object treeNode : selection.toList()) { RepositoryNode repo = (RepositoryNode) treeNode; reposToRemove.add(repo.getRepository().getDirectory()); } RepositoryGroups.getInstance().removeFromGroups(reposToRemove); refreshRepositoriesView(); return Status.OK_STATUS; } } return Status.CANCEL_STATUS; }
Source:
public RuleResult validate(final PasswordData passwordData) { final String matchingChars = PasswordUtils.getMatchingCharacters( String.valueOf(characterData.getCharacters()), passwordData.getPassword(), numCharacters); if (matchingChars.length() < numCharacters) { return new RuleResult( false, new RuleResultDetail(characterData.getErrorCode(), createRuleResultDetailParameters(matchingChars))); } else { return new RuleResult(true); } }

Target:
public RuleResult validate(final PasswordData passwordData) { final String matchingChars = PasswordUtils.getMatchingCharacters( String.valueOf(characterData.getCharacters()), passwordData.getPassword(), numCharacters); if (matchingChars.length() < numCharacters) { return new RuleResult( false, new RuleResultDetail(characterData.getErrorCode(), createRuleResultDetailParameters(matchingChars))); } return new RuleResult(true); }
Source:
public InternalThreadExecutor() { super(Config.<Integer> GetValue(ConfigValues.DefaultThreadPoolSize), Config.<Integer> GetValue(ConfigValues.DefaultThreadPoolSize), 0L, TimeUnit.MILLISECONDS, new LinkedBlockingQueue<Runnable>()); }

Target:
public InternalThreadExecutor() { super(Config.<Integer> GetValue(ConfigValues.DefaultMinThreadPoolSize), Config.<Integer> GetValue(ConfigValues.DefaultMaxThreadPoolSize), 60L, TimeUnit.SECONDS, new ArrayBlockingQueue<Runnable>(Config.<Integer> GetValue(ConfigValues.DefaultMaxSizeOfWaitingTasks))); }
Source:
public static void readFileMetaData(InputStream from, FileMetaDataConsumer consumer) throws IOException { readFileMetaData(from, consumer, (BlockCipher.Decryptor) null, (byte[]) null); }

Target:
public static void readFileMetaData(InputStream from, FileMetaDataConsumer consumer) throws IOException { readFileMetaData(from, consumer, null, null); }
Source:
public void startClose() { close = true; }

Target:
void startClose() { stateMachine.setState(STATE_CLOSING); }
Source:
public GatewayBranch getBranch(String id) { for(GatewayBranch branch : branchList) { if(id.equals(branch.getId())) { return branch; } } return null; }

Target:
public Optional<GatewayBranch> getBranch(String id) { for (GatewayBranch branch : branchList) { if (id.equals(branch.getId())) { return Optional.of(branch); } } return Optional.empty(); }
Source:
public SliceSampler(final RandomGenerator rng, final Function<Double, Double> logPDF, final double xMin, final double xMax, final double width) { Utils.nonNull(rng); Utils.nonNull(logPDF); if (xMin > xMax) { throw new IllegalArgumentException("Maximum bound must be larger than minimum bound."); } ParamUtils.isPositive(width, "Slice-sampling width must be positive."); this.rng = rng; this.logPDF = logPDF; this.xMin = xMin; this.xMax = xMax; this.width = width; this.exponentialDistribution = new ExponentialDistribution(rng, 1.); }

Target:
public SliceSampler(final RandomGenerator rng, final Function<Double, Double> logPDF, final double xMin, final double xMax, final double width) { Utils.nonNull(rng); Utils.nonNull(logPDF); Utils.validateArg(xMin <= xMax, "Maximum bound must be greater than or equal to minimum bound."); ParamUtils.isPositive(width, "Slice-sampling width must be positive."); this.rng = rng; this.logPDF = logPDF; this.xMin = xMin; this.xMax = xMax; this.width = width; this.exponentialDistribution = new ExponentialDistribution(rng, 1.); }
Source:
public List<BackPackedListData> getBackPackedListData() { return backPackedListData != null ? backPackedListData : new ArrayList<BackPackedListData>(); }

Target:
public List<BackPackedListData> getBackPackedListData() { return backPackedListData; }
Source:
public int read(WritableByteChannel channel) throws IOException { int bytesWritten = streamEnded.get() ? -1 : 0; if (!channelOpen.get()) { throw new ClosedChannelException(); } else if (!streamEnded.get()) { try { contentLock.lock(); int currentBytesWritten = requestContents.size() > 0 ? requestContents.get(0).read(channel) : 0; while (currentBytesWritten != 0) { if (currentBytesWritten == -1) { NettyContent nettyContent = requestContents.remove(0); nettyContent.release(); streamEnded.set(nettyContent.isLast()); } else { bytesWritten += currentBytesWritten; } currentBytesWritten = 0; if (!streamEnded.get() && requestContents.size() > 0) { currentBytesWritten = requestContents.get(0).read(channel); } } } finally { contentLock.unlock(); } } return bytesWritten; }

Target:
public int read(WritableByteChannel channel) throws IOException { int bytesWritten; if (!channelOpen.get()) { throw new ClosedChannelException(); } else if (streamEnded.get()) { bytesWritten = -1; } else { bytesWritten = 0; contentLock.lock(); try { int currentBytesWritten = requestContents.size() > 0 ? requestContents.get(0).read(channel) : 0; while (currentBytesWritten != 0) { if (currentBytesWritten == -1) { NettyContent nettyContent = requestContents.remove(0); nettyContent.release(); streamEnded.set(nettyContent.isLast()); } else { bytesWritten += currentBytesWritten; } currentBytesWritten = 0; if (!streamEnded.get() && requestContents.size() > 0) { currentBytesWritten = requestContents.get(0).read(channel); } } } finally { contentLock.unlock(); } } return bytesWritten; }
Source:
protected ResourceConverter getResourceConverter() { DataCleanerConfiguration configuration = getAnalysisJobBuilder().getConfiguration(); return new ResourceConverter(configuration); }

Target:
protected ResourceConverter getResourceConverter() { final DataCleanerConfiguration configuration = getAnalysisJobBuilder().getConfiguration(); return new ResourceConverter(configuration); }
Source:
public void onReceive(Context context, Intent intent) { Bundle bundle = intent.getExtras(); if (bundle == null || "google.com/iid".equals(bundle.getString("from"))) return; OneSignal.setAppContext(context); ProcessedBundleResult processedResult = processOrderBroadcast(context, intent, bundle); if (processedResult == null) { setSuccessfulResultCode(); return; } if (processedResult.isDup || processedResult.hasExtenderService || processedResult.isOneSignalPayload) { setAbort(); return; } setSuccessfulResultCode(); }

Target:
public void onReceive(Context context, Intent intent) { Bundle bundle = intent.getExtras(); if (bundle == null || "google.com/iid".equals(bundle.getString("from"))) return; OneSignal.setAppContext(context); ProcessedBundleResult processedResult = processOrderBroadcast(context, intent, bundle); if (processedResult == null) { setSuccessfulResultCode(); return; } if (processedResult.isDup || processedResult.hasExtenderService) { setAbort(); return; } setSuccessfulResultCode(); }
Source:
public ButtonBase(ComponentContainer container) { super(container); view = (T)(new android.widget.Button(container.$context())); defaultButtonDrawable = view.getBackground(); defaultColorStateList = view.getTextColors(); defaultButtonMinWidth = KitkatUtil.getMinWidth(view); defaultButtonMinHeight = KitkatUtil.getMinHeight(view); container.$add(this); view.setOnClickListener(this); view.setOnFocusChangeListener(this); view.setOnLongClickListener(this); view.setOnTouchListener(this); IceCreamSandwichUtil.setAllCaps(view, false); TextAlignment(Component.ALIGNMENT_CENTER); BackgroundColor(Component.COLOR_DEFAULT); Image(""); Enabled(true); fontTypeface = Component.TYPEFACE_DEFAULT; TextViewUtil.setFontTypeface(view, fontTypeface, bold, italic); FontSize(Component.FONT_DEFAULT_SIZE); Text(""); TextColor(Component.COLOR_DEFAULT); Shape(Component.BUTTON_SHAPE_DEFAULT); }

Target:
public ButtonBase(ComponentContainer container) { this(container, (T) (new android.widget.Button(container.$context()))); }
Source:
public void logAuditMessage(final Guid clusterId, final GlusterVolumeEntity volume, final VDS server, final AuditLogType logType, final Map<String, String> customValues) { AuditLogableBase logable = Injector.injectMembers(new AuditLogableBase()); logable.setVds(server); logable.setGlusterVolume(volume); logable.setClusterId(clusterId); if (customValues != null) { customValues.entrySet().stream().forEach(e -> logable.addCustomValue(e.getKey(), e.getValue())); } auditLogDirector.log(logable, logType); }

Target:
public void logAuditMessage(final Guid clusterId, final GlusterVolumeEntity volume, final VDS server, final AuditLogType logType, final Map<String, String> customValues) { AuditLogableBase logable = Injector.injectMembers(new AuditLogableBase()); logable.setVds(server); logable.setGlusterVolume(volume); logable.setClusterId(clusterId); if (customValues != null) { customValues.entrySet().forEach(e -> logable.addCustomValue(e.getKey(), e.getValue())); } auditLogDirector.log(logable, logType); }
Source:
private void enable() { if (fEditor != null) { if (fReconciler != null) { fReconciler.uninstall(); } fReconciler= new JavaCodeMiningReconciler(); fReconciler.install(fEditor, fSourceViewer); } }

Target:
private void enable() { if (fEditor != null) { if (fReconciler != null) { fReconciler.updateCodeMinings(); } else { fReconciler= new JavaCodeMiningReconciler(); fReconciler.install(fEditor, fSourceViewer); } } }
Source:
public void onServerTemplateDeleted(@Observes ServerTemplateDeleted serverTemplateDeleted) { serverTemplatesClients.computeIfPresent(serverTemplateDeleted.getServerTemplateId(), (serverTemplateId, clients) -> { logger.debug("KieServerClient removed and closed for server template {}", serverTemplateId.equals("") ? serverTemplateDeleted.getServerTemplateId() : serverTemplateId); return null; }); adminClients.remove(serverTemplateDeleted.getServerTemplateId()); removeServerInstancesFromIndex(serverTemplateDeleted.getServerTemplateId()); }

Target:
public void onServerTemplateDeleted(@Observes ServerTemplateDeleted serverTemplateDeleted) { final Map<String, KieServicesClient> clients = serverTemplatesClients.remove(serverTemplateDeleted.getServerTemplateId()); if (clients != null) { logger.debug("KieServerClient removed and closed for server template {}", serverTemplateDeleted.getServerTemplateId()); } adminClients.remove(serverTemplateDeleted.getServerTemplateId()); removeServerInstancesFromIndex(serverTemplateDeleted.getServerTemplateId()); }
Source:
private void addCategoriesAsTags(Set<TestTag> tags) { Category annotation = description.getAnnotation(Category.class); if (annotation != null) { Stream.of(annotation.value()) .map(ReflectionUtils::getAllAssignmentCompatibleClasses) .flatMap(Collection::stream) .distinct() .map(Class::getName) .map(TestTag::create) .forEachOrdered(tags::add); } }

Target:
private void addCategoriesAsTags(Set<TestTag> tags) { Category annotation = description.getAnnotation(Category.class); if (annotation != null) { stream(annotation.value()) .map(ReflectionUtils::getAllAssignmentCompatibleClasses) .flatMap(Collection::stream) .distinct() .map(Class::getName) .map(TestTag::create) .forEachOrdered(tags::add); } }
Source:
protected Query newTermQuery(final Term term, float boost) { if (term.text().contains(identifier)) { SuggesterPrefixQuery q = new SuggesterPrefixQuery(replaceIdentifier(term, identifier)); this.suggesterQuery = q; return q; } return super.newTermQuery(term, boost); }

Target:
protected Query newTermQuery(final Term term, float boost) { if (term.text().contains(identifier)) { Query q = new SuggesterPrefixQuery(replaceIdentifier(term, identifier)); this.suggesterQuery = (SuggesterPrefixQuery) q; if (boost != DEFAULT_BOOST) { q = new BoostQuery(q, boost); } return q; } return super.newTermQuery(term, boost); }
Source:
private void disableMenuItem(Menu menu, int rID) { MenuItem item = menu.findItem(rID); item.setEnabled(false); item.setVisible(false); }

Target:
private void disableMenuItem(Menu menu, int rID) { MenuItem item = menu.findItem(rID); if(item != null) { item.setEnabled(false); item.setVisible(false); } }
Source:
public JsonElement serialize(Arguments arguments, Type type, JsonSerializationContext context) { JsonObject root = new JsonObject(); if (arguments.game != null) { JsonArray gameArguments = new JsonArray(); arguments.game.forEach(arg -> { if (arg.rules != null) { JsonObject object = new JsonObject(); object.add("rules", Gsons.MINECRAFT.toJsonTree(arg.rules)); if (arg.value instanceof String) { object.add("value", Gsons.MINECRAFT.toJsonTree(arg.value)); } else if (arg.value instanceof List) { object.add("value", Gsons.MINECRAFT.toJsonTree(arg.value)); } gameArguments.add(object); } else { gameArguments.add((String) arg.value); } }); root.add("game", gameArguments); } if (arguments.jvm != null) { JsonArray jvmArguments = new JsonArray(); arguments.jvm.forEach(arg -> { if (arg.rules != null) { JsonObject object = new JsonObject(); object.add("rules", Gsons.MINECRAFT.toJsonTree(arg.rules)); if (arg.value instanceof String) { object.add("value", Gsons.MINECRAFT.toJsonTree(arg.value)); } else if (arg.value instanceof List) { object.add("value", Gsons.MINECRAFT.toJsonTree(arg.value)); } jvmArguments.add(object); } else { jvmArguments.add((String) arg.value); } }); root.add("jvm", jvmArguments); } return root; }

Target:
public JsonElement serialize(Arguments arguments, Type type, JsonSerializationContext context) { JsonObject root = new JsonObject(); if (arguments.game != null) { JsonArray gameArguments = new JsonArray(); arguments.game.forEach(arg -> { if (arg.rules != null) { JsonObject object = new JsonObject(); object.add("rules", Gsons.MINECRAFT.toJsonTree(arg.rules)); if (arg.value instanceof String || arg.value instanceof List) { object.add("value", Gsons.MINECRAFT.toJsonTree(arg.value)); } gameArguments.add(object); } else { gameArguments.add((String) arg.value); } }); root.add("game", gameArguments); } if (arguments.jvm != null) { JsonArray jvmArguments = new JsonArray(); arguments.jvm.forEach(arg -> { if (arg.rules != null) { JsonObject object = new JsonObject(); object.add("rules", Gsons.MINECRAFT.toJsonTree(arg.rules)); if (arg.value instanceof String || arg.value instanceof List) { object.add("value", Gsons.MINECRAFT.toJsonTree(arg.value)); } jvmArguments.add(object); } else { jvmArguments.add((String) arg.value); } }); root.add("jvm", jvmArguments); } return root; }
Source:
protected static Object getDelegateFromUnmodifiableNavigableSet(NavigableSet<?> object) { try { Class<?> clazz = Class.forName(Sets.class.getCanonicalName() + "$UnmodifiableNavigableSet"); Field field = clazz.getDeclaredField("delegate"); field.setAccessible(true); return field.get(object); } catch (IllegalArgumentException e) { throw new RuntimeException("Issues reflectively writing UnmodifiableNavigableSet", e); } catch (IllegalAccessException e) { throw new RuntimeException("Issues reflectively writing UnmodifiableNavigableSet", e); } catch (ClassNotFoundException e) { throw new RuntimeException("Issues reflectively writing UnmodifiableNavigableSet", e); } catch (SecurityException e) { throw new RuntimeException("Issues reflectively writing UnmodifiableNavigableSet", e); } catch (NoSuchFieldException e) { throw new RuntimeException("Issues reflectively writing UnmodifiableNavigableSet", e); } }

Target:
protected Object getDelegateFromUnmodifiableNavigableSet(NavigableSet<?> object) { try { return delegate.get(object); } catch (IllegalArgumentException e) { throw new RuntimeException("Issues reflectively writing UnmodifiableNavigableSet", e); } catch (IllegalAccessException e) { throw new RuntimeException("Issues reflectively writing UnmodifiableNavigableSet", e); } }
Source:
public void clear() { clearSocialLoginToken(); setSubtitleLanguage(null); setPlaybackSpeed(1.0f); pref.put(PrefManager.Key.PROFILE_JSON, null); pref.put(PrefManager.Key.AUTH_JSON, null); EdxCookieManager.getSharedInstance(MainApplication.instance()).clearWebWiewCookie(); }

Target:
public void clear() { clearSocialLoginToken(); setSubtitleLanguage(null); saveDefaultPlaybackSpeed(VideoPlaybackSpeed.NORMAL.getSpeedValue()); pref.put(PrefManager.Key.PROFILE_JSON, null); pref.put(PrefManager.Key.AUTH_JSON, null); EdxCookieManager.getSharedInstance(MainApplication.instance()).clearWebWiewCookie(); }
Source:
@Test public void withImports() throws IOException { ClassWriter classWriter = ClassWriter.forClassName(className); classWriter.addField(threadName, "thread"); ConstructorWriter constructorWriter = classWriter.addConstructor(); AnonymousClassWriter threadWriter = AnonymousClassWriter.forClassName(threadName); FieldWriter threadListField = threadWriter.addField( ParameterizedTypeName.create(List.class, ClassName.fromClass(String.class)), "list"); threadListField.setInitializer("%s.asList(\"Hello World\")", ClassName.fromClass(Arrays.class)); MethodWriter threadStartMethod = threadWriter.addMethod(void.class, "start"); threadStartMethod.annotate(Override.class); threadStartMethod.addModifiers(PUBLIC); threadStartMethod.body().addSnippet("System.out.println(list.get(0));"); constructorWriter.body().addSnippet("thread = %s;", threadWriter); StringBuilder stringBuilder = new StringBuilder(); assertThat(classWriter.writeTypeToAppendable(stringBuilder).toString()).isEqualTo("" + "package com.foo;\n" + "\n" + "import java.util.Arrays;\n" + "import java.util.List;\n" + "\n" + "class Bar {\n" + " Thread thread;\n" + "\n" + " Bar() {\n" + " thread = new Thread() {\n" + " List<String> list = Arrays.asList(\"Hello World\");\n" + "\n" + " @Override\n" + " public void start() {\n" + " System.out.println(list.get(0));\n" + " }\n" + " };\n" + " }\n" + "}\n"); }

Target:
@Test public void withImports() throws IOException { ClassWriter classWriter = ClassWriter.forClassName(className); classWriter.addField(threadName, "thread"); ConstructorWriter constructorWriter = classWriter.addConstructor(); AnonymousClassWriter threadWriter = AnonymousClassWriter.forClassName(threadName); FieldWriter threadListField = threadWriter.addField( ParameterizedTypeName.create(List.class, ClassName.fromClass(String.class)), "list"); threadListField.setInitializer("%s.asList(\"Hello World\")", ClassName.fromClass(Arrays.class)); MethodWriter threadStartMethod = threadWriter.addMethod(void.class, "start"); threadStartMethod.annotate(Override.class); threadStartMethod.addModifiers(PUBLIC); threadStartMethod.body().addSnippet("System.out.println(list.get(0));"); constructorWriter.body().addSnippet("thread = %s;", threadWriter); assertThat(classWriter.toString()).isEqualTo("" + "package com.foo;\n" + "\n" + "import java.util.Arrays;\n" + "import java.util.List;\n" + "\n" + "class Bar {\n" + " Thread thread;\n" + "\n" + " Bar() {\n" + " thread = new Thread() {\n" + " List<String> list = Arrays.asList(\"Hello World\");\n" + "\n" + " @Override\n" + " public void start() {\n" + " System.out.println(list.get(0));\n" + " }\n" + " };\n" + " }\n" + "}\n"); }
Source:
protected boolean validateRawCoordinates() { if (rawGeometryCoordinates.length != 3) { log.error("Invalid arc geometry. Arc must be represented by 3 points in GML."); return false; } return true; }

Target:
protected boolean validateRawCoordinates() { if (rawGeometryCoordinates.length != 3) { log.error("Invalid arc geometry. Arc must be represented by 3 points."); return false; } return true; }
Source:
public void start(Set<File> files, Consumer<Set<File>> callback) { if (isStarted()) { throw new IllegalStateException("start() should not be called more than once"); } Preconditions.checkArgument(files.size() > 0, "must specify at least 1 file to watch for changes"); this.callback = requireNonNull(callback); watchedFiles = ImmutableSet.copyOf(files); executorService = MoreExecutors.listeningDecorator(Executors.newScheduledThreadPool(1)); future = executorService.scheduleAtFixedRate( this::scanFilesForChanges, initialDelay, interval, timeUnit); }

Target:
@Override public void start(Set<File> files, Consumer<Set<File>> callback) { if (isStarted()) { throw new IllegalStateException("start() should not be called more than once"); } Set<File> filesCopy = ImmutableSet.copyOf(files); Preconditions.checkArgument(filesCopy.size() > 0, "must specify at least 1 file to watch for changes"); this.callback = requireNonNull(callback); watchedFiles = filesCopy; executorService = MoreExecutors.listeningDecorator(Executors.newScheduledThreadPool(1)); future = executorService.scheduleAtFixedRate( this::scanFilesForChanges, initialDelay, interval, timeUnit); }
Source:
public void start(List<PluginWrapper> plugins) throws Exception { try (ACLContext context = ACL.as(ACL.SYSTEM)) { Map<String, PluginWrapper> pluginsByName = plugins.stream().collect(Collectors.toMap(p1 -> p1.getShortName(), p -> p)); for (PluginWrapper depender : this.plugins) { if (plugins.contains(depender)) { continue; } for (Dependency d : depender.getOptionalDependencies()) { PluginWrapper dependee = pluginsByName.get(d.shortName); if (dependee != null) { getPluginStrategy().updateDependency(depender, dependee); break; } } } Jenkins.get().refreshExtensions(); for (PluginWrapper p : plugins) { p.getPlugin().postInitialize(); } Reactor r = new Reactor(InitMilestone.ordering()); Set<ClassLoader> loaders = plugins.stream().map(p -> p.classLoader).collect(Collectors.toSet()); r.addAll(new InitializerFinder(uberClassLoader) { @Override protected boolean filter(Method e) { return !loaders.contains(e.getDeclaringClass().getClassLoader()) || super.filter(e); } }.discoverTasks(r)); new InitReactorRunner().run(r); resolveDependentPlugins(); try { Jenkins.get().refreshExtensions(); } catch (ExtensionRefreshException e) { throw new IOException("Failed to refresh extensions after installing some plugins", e); } } }

Target:
public void start(List<PluginWrapper> plugins) throws Exception { try (ACLContext context = ACL.as(ACL.SYSTEM)) { Map<String, PluginWrapper> pluginsByName = plugins.stream().collect(Collectors.toMap(p -> p.getShortName(), p -> p)); for (PluginWrapper depender: this.plugins) { if (plugins.contains(depender)) { continue; } for (Dependency d: depender.getOptionalDependencies()) { PluginWrapper dependee = pluginsByName.get(d.shortName); if (dependee != null) { getPluginStrategy().updateDependency(depender, dependee); break; } } } resolveDependentPlugins(); try { Jenkins.get().refreshExtensions(); } catch (ExtensionRefreshException e) { throw new IOException("Failed to refresh extensions after installing some plugins", e); } for (PluginWrapper p : plugins) { p.getPlugin().postInitialize(); } Reactor r = new Reactor(InitMilestone.ordering()); Set<ClassLoader> loaders = plugins.stream().map(p -> p.classLoader).collect(Collectors.toSet()); r.addAll(new InitializerFinder(uberClassLoader) { @Override protected boolean filter(Method e) { return !loaders.contains(e.getDeclaringClass().getClassLoader()) || super.filter(e); } }.discoverTasks(r)); new InitReactorRunner().run(r); } }
Source:
public void fireCallback(final ClientCallback call) { try { call.setMessageId(messageId++); callbackHandler.handleCallbackOneway(new Callback(call)); } catch (HandleCallbackException ex) { ex.printStackTrace(); UserManager.getInstance().getUser(userId).ifPresent(user-> { logger.warn("SESSION CALLBACK EXCEPTION - " + (user != null ? user.getName() : "") + " userId " + userId); logger.warn(" - method: " + call.getMethod()); logger.warn(" - cause: " + getBasicCause(ex).toString()); logger.trace("Stack trace:", ex); userLostConnection(); }); } }

Target:
public void fireCallback(final ClientCallback call) { try { call.setMessageId(messageId++); callbackHandler.handleCallbackOneway(new Callback(call)); } catch (HandleCallbackException ex) { ex.printStackTrace(); UserManager.getInstance().getUser(userId).ifPresent(user-> { logger.warn("SESSION CALLBACK EXCEPTION - " + user.getName() + " userId " + userId); logger.warn(" - method: " + call.getMethod()); logger.warn(" - cause: " + getBasicCause(ex).toString()); logger.trace("Stack trace:", ex); userLostConnection(); }); } }
Source:
JWTProcessor<SecurityContext> processor() { ResourceRetriever jwkSetRetriever = new RestOperationsResourceRetriever(this.restOperations); JWKSource<SecurityContext> jwkSource = jwkSource(jwkSetRetriever); ConfigurableJWTProcessor<SecurityContext> jwtProcessor = new DefaultJWTProcessor<>(); jwtProcessor.setJWSKeySelector(jwsKeySelector(jwkSource)); jwtProcessor.setJWTClaimsSetVerifier((claims, context) -> { }); jwtProcessorCustomizer.accept(jwtProcessor); return jwtProcessor; }

Target:
JWTProcessor<SecurityContext> processor() { ResourceRetriever jwkSetRetriever = new RestOperationsResourceRetriever(this.restOperations); JWKSource<SecurityContext> jwkSource = jwkSource(jwkSetRetriever); ConfigurableJWTProcessor<SecurityContext> jwtProcessor = new DefaultJWTProcessor<>(); jwtProcessor.setJWSKeySelector(jwsKeySelector(jwkSource)); jwtProcessor.setJWTClaimsSetVerifier((claims, context) -> { }); this.jwtProcessorCustomizer.accept(jwtProcessor); return jwtProcessor; }
Source:
public List<GridColumn.HeaderMetaData> makeHeaderMetaData(final BaseColumn column) { final ArrayList<GridColumn.HeaderMetaData> result = new ArrayList<>(); result.add(new BaseHeaderMetaData(GuidedDecisionTableConstants.INSTANCE.RuleName(), RuleNameColumn.class.getName())); return result; }

Target:
public List<GridColumn.HeaderMetaData> makeHeaderMetaData(final BaseColumn column) { return Collections.singletonList(new BaseHeaderMetaData(GuidedDecisionTableConstants.INSTANCE.RuleName(), RuleNameColumn.class.getName())); }
Source:
public boolean canRestartModule(IModule[] module) { if( module.length == 1 ) return true; return false; }

Target:
public boolean canRestartModule(IModule[] module) { if( module.length == 1 && module[0] != null) return true; return false; }
Source:
public void setWatchEvents(WatchEventType... watchEvents) { Assert.notEmpty(watchEvents, "'watchEvents' must not be empty."); this.watchEvents = watchEvents; }

Target:
public void setWatchEvents(WatchEventType... watchEvents) { Assert.notEmpty(watchEvents, "'watchEvents' must not be empty."); Assert.noNullElements(watchEvents, "'watchEvents' must not contain null elements."); Assert.state(!this.running, "Cannot change watch events while running."); this.watchEvents = Arrays.copyOf(watchEvents, watchEvents.length); }
Source:
public void execute(Context context) throws SQLException { String builtInQGUuid = context.prepareSelect("select uuid from quality_gates where is_built_in = ?") .setBoolean(1, true) .get(row -> row.getString(1)); if (builtInQGUuid == null) { throw new IllegalStateException("Unable to find the builtin quality gate"); } MassUpdate massUpdate = context.prepareMassUpdate(); massUpdate.select("select uuid from organizations " + " where default_quality_gate_uuid is null"); massUpdate.rowPluralName("organizations"); massUpdate.update("update organizations set default_quality_gate_uuid = ?, updated_at=? where uuid = ?"); massUpdate.execute((row, update) -> { update.setString(1, builtInQGUuid); update.setLong(2, system2.now()); update.setString(3, row.getString(1)); return true; }); }

Target:
public void execute(Context context) throws SQLException { List<String> builtInQGUuids = context.prepareSelect("select uuid from quality_gates where is_built_in = ?") .setBoolean(1, true) .list(row -> row.getString(1)); checkState(!builtInQGUuids.isEmpty(), "Unable to find the builtin quality gate"); checkState(builtInQGUuids.size() == 1, "There are too many built in quality gates, one and only one is expected"); final long now = system2.now(); MassUpdate massUpdate = context.prepareMassUpdate(); massUpdate.select("select uuid from organizations " + " where default_quality_gate_uuid is null"); massUpdate.rowPluralName("organizations"); massUpdate.update("update organizations set default_quality_gate_uuid = ?, updated_at=? where uuid = ?"); massUpdate.execute((row, update) -> { update.setString(1, builtInQGUuids.get(0)); update.setLong(2, now); update.setString(3, row.getString(1)); return true; }); }
Source:
private void setAddPreferencesFromResourceBlock() { JMethod method = getGeneratedClass().method(PUBLIC, codeModel().VOID, "addPreferencesFromResource"); method.annotate(Override.class); JVar preferencesResIdParam = method.param(int.class, "preferencesResId"); method.body().invoke(JExpr._super(), "addPreferencesFromResource").arg(preferencesResIdParam); addPreferencesFromResourceBlock = method.body(); addPreferencesFromResourceBlockBeforeInject = addPreferencesFromResourceBlock.blockSimple(); }

Target:
private void setAddPreferencesFromResourceBlock() { JMethod method = getGeneratedClass().method(PUBLIC, codeModel().VOID, "addPreferencesFromResource"); method.annotate(Override.class); JVar preferencesResIdParam = method.param(int.class, "preferencesResId"); method.body().invoke(JExpr._super(), "addPreferencesFromResource").arg(preferencesResIdParam); addPreferencesFromResourceInjectionBlock = method.body().blockVirtual(); addPreferencesFromResourceAfterInjectionBlock = method.body().blockVirtual(); }
Source:
public boolean add(NonTerminal newNT) { if (startNonTerminals.containsKey(newNT.nonTerminalId)) { return false; } else { startNonTerminals.put(newNT.nonTerminalId, newNT); return true; } }

Target:
public boolean add(NonTerminal newNT) { if (startNonTerminals.containsKey(newNT.name)) { return false; } else { startNonTerminals.put(newNT.name, newNT); return true; } }
Source:
public VDSReturnValue get(long timeout, TimeUnit unit) throws TimeoutException { try { status = new StatusOnlyReturnForXmlRpc(httpTask.get(timeout, unit)); proceedProxyReturnValue(); } catch (TimeoutException e) { httpTask.cancel(true); VDSNetworkException ex = new VDSNetworkException("Timeout during xml-rpc call"); ex.setVdsError(new VDSError(EngineError.VDS_NETWORK_ERROR, "Timeout during xml-rpc call")); setVdsRuntimeError(ex); log.error("Timeout waiting for VDSM response: {}", e.getMessage()); log.debug("Exception", e); throw e; } catch (VDSNetworkException e) { setVdsRuntimeError(e); if (!"Policy reset".equals(e.getVdsError().getMessage())) { log.error("Error: {}", e.getMessage()); log.error("Exception", e); } else { log.info("Policy reset required for network reconfiguration"); } } catch (Exception e) { log.error("Error: {}", e.getMessage()); log.error("Exception", e); setVdsRuntimeError(e instanceof RuntimeException ? (RuntimeException) e : new RuntimeException(e)); } return getVDSReturnValue(); }

Target:
public VDSReturnValue get(long timeout, TimeUnit unit) throws TimeoutException { try { status = new StatusOnlyReturnForXmlRpc(httpTask.get(timeout, unit)); proceedProxyReturnValue(); } catch (TimeoutException e) { httpTask.cancel(true); VDSNetworkException ex = new VDSNetworkException("Timeout during xml-rpc call"); ex.setVdsError(new VDSError(EngineError.VDS_NETWORK_ERROR, "Timeout during xml-rpc call")); setVdsRuntimeError(ex); log.error("Timeout waiting for VDSM response: {}", e.getMessage()); log.debug("Exception", e); throw e; } catch (VDSNetworkException e) { setVdsRuntimeError(e); if (isPolicyResetMessage(e.getVdsError().getMessage())) { log.info("Policy reset required for network reconfiguration"); } else { log.error("Error: {}", e.getMessage()); log.error("Exception", e); } } catch (Exception e) { log.error("Error: {}", e.getMessage()); log.error("Exception", e); setVdsRuntimeError(e instanceof RuntimeException ? (RuntimeException) e : new RuntimeException(e)); } return getVDSReturnValue(); }
Source:
public void testGetSWTColor() { Color result = getSWTColor(colorValue("red"), display); assertNotNull(result); assertEquals(255, result.getRed()); assertEquals(0, result.getBlue()); assertEquals(0, result.getGreen()); }

Target:
public void testGetSWTColor() { result = getSWTColor(colorValue("red"), display); assertNotNull(result); assertEquals(255, result.getRed()); assertEquals(0, result.getBlue()); assertEquals(0, result.getGreen()); }
Source:
public String getUserAgent() { if(userAgent == null) { String ua = this.getUserAgentFromResource(); if(Misc.isRunningOnAndroid()) { try { Class c = Class.forName("android.os.Build$VERSION"); String codename = (String)c.getField("CODENAME").get(null); int sdkInt = c.getField("SDK_INT").getInt(null); userAgent = String.format("%s Android %s %d", ua, codename, sdkInt); } catch (Exception e) { userAgent = "?"; } } else { userAgent = String.format("%s (%s; %s; %s)", ua, System.getProperty("os.arch"), System.getProperty("os.name"), System.getProperty("os.version")); } } return userAgent; }

Target:
public String getUserAgent() { if(userAgent == null) { String ua = this.getUserAgentFromResource(); if(Misc.isRunningOnAndroid()) { try { Class c = Class.forName("android.os.Build$VERSION"); String codename = (String)c.getField("CODENAME").get(null); int sdkInt = c.getField("SDK_INT").getInt(null); userAgent = String.format("%s Android %s %d", ua, codename, sdkInt); } catch (Exception e) { userAgent = String.format("%s Android unknown version", ua); } } else { userAgent = String.format("%s (%s; %s; %s)", ua, System.getProperty("os.arch"), System.getProperty("os.name"), System.getProperty("os.version")); } } return userAgent; }
Source:
void testVerifierEnabled() throws InterruptedException { TestVerifier verifier = new TestVerifier(true); ExecutorService executorService = Executors.newSingleThreadExecutor(); DarkClusterVerifierManager verifierManager = new DarkClusterVerifierManagerImpl(verifier, executorService); RestRequest dummyRestRequest = new RestRequestBuilder(URI.create("foo")).build(); RestResponse res = new RestResponseBuilder().build(); verifierManager.onDarkResponse(dummyRestRequest, res, DARK_CLUSTER1_NAME); verifierManager.onDarkResponse(dummyRestRequest, res, DARK_CLUSTER1_NAME); verifierManager.onResponse(dummyRestRequest, res); final CountDownLatch latch = new CountDownLatch(1); Runnable myCallable = latch::countDown; executorService.submit(myCallable); if (!latch.await(30, TimeUnit.SECONDS)) { fail("unable to execute task on executor"); } Assert.assertEquals(verifier.onResponseCount, 1, "expected on response count of 1"); Assert.assertEquals(verifier.onDarkResponseCount, 2, "expected on dark response count of 2"); }

Target:
public void testVerifierEnabled() throws InterruptedException { setup(true); RestRequest dummyRestRequest = new RestRequestBuilder(URI.create("foo")).build(); RestResponse res = new RestResponseBuilder().build(); _verifierManager.onDarkResponse(dummyRestRequest, res, DARK_CLUSTER1_NAME); _verifierManager.onDarkResponse(dummyRestRequest, res, DARK_CLUSTER1_NAME); _verifierManager.onResponse(dummyRestRequest, res); waitForLatch(); Assert.assertEquals(_verifier.onResponseCount, 1, "expected on response count of 1"); Assert.assertEquals(_verifier.onDarkResponseCount, 2, "expected on dark response count of 2"); }
Source:
private void postInitTemplate(List<VmTemplate> templates) { List<VmTemplate> baseWithoutBlank = filterOutBlank(keepBaseTemplates(templates)); if (baseWithoutBlank.isEmpty()) { getModel().getIsSubTemplate().setEntity(false); getModel().getIsSubTemplate().setIsChangeable(false, constants.someNonDefaultTemplateHasToExistFirst()); return; } getModel().getIsSubTemplate().setEntity(false); getModel().getIsSubTemplate().setIsChangeable(true); VmTemplate currentTemplate = Linq.firstOrDefault(templates, new Linq.TemplatePredicate(vm.getVmtGuid())); getModel().getBaseTemplate().setItems(baseWithoutBlank); getModel().getBaseTemplate().setSelectedItem(Linq.firstOrDefault(baseWithoutBlank, new Linq.TemplatePredicate(currentTemplate.getBaseTemplateId()))); }

Target:
private void postInitTemplate(List<VmTemplate> templates) { List<VmTemplate> baseWithoutBlank = filterOutBlank(keepBaseTemplates(templates)); getModel().getIsSubTemplate().setEntity(false); if (baseWithoutBlank.isEmpty()) { getModel().getIsSubTemplate().setIsChangeable(false, constants.someNonDefaultTemplateHasToExistFirst()); return; } getModel().getIsSubTemplate().setIsChangeable(true); VmTemplate currentTemplate = Linq.firstOrDefault(templates, new Linq.TemplatePredicate(vm.getVmtGuid())); getModel().getBaseTemplate().setItems(baseWithoutBlank); getModel().getBaseTemplate().setSelectedItem(Linq.firstOrDefault(baseWithoutBlank, new Linq.TemplatePredicate(currentTemplate.getBaseTemplateId()))); }
Source:
public String getFriendlyCategoryName(){ switch (this.dataverseType) { case RESEARCHERS: return BundleUtil.getStringFromBundle("dataverse.type.selectTab.researchers", null , "en"); case RESEARCH_PROJECTS: return BundleUtil.getStringFromBundle("dataverse.type.selectTab.researchProjects",null, "en"); case JOURNALS: return BundleUtil.getStringFromBundle("dataverse.type.selectTab.journals", null, "en"); case ORGANIZATIONS_INSTITUTIONS: return BundleUtil.getStringFromBundle("dataverse.type.selectTab.organizationsAndInsitutions",null, "en"); case TEACHING_COURSES: return BundleUtil.getStringFromBundle("dataverse.type.selectTab.teachingCourses",null, "en"); case LABORATORY: return BundleUtil.getStringFromBundle("dataverse.type.selectTab.laboratory",null, "en"); case RESEARCH_GROUP: return BundleUtil.getStringFromBundle("dataverse.type.selectTab.researchGroup",null, "en"); case DEPARTMENT: return BundleUtil.getStringFromBundle("dataverse.type.selectTab.department",null, "en"); case UNCATEGORIZED: return uncategorizedString; default: return ""; } }

Target:
public String getFriendlyCategoryName(){ String key = getFriendlyCategoryKey(); return BundleUtil.getStringFromBundle(key); }
Source:
private boolean exceedsCappedLimit() throws NoConnectionsException, IOException, ProcCallException { boolean ret = false; VoltTable partitions = client.callProcedure("@GetPartitionKeys", "INTEGER").getResults()[0]; long count = TxnId2Utils.doAdHoc(client,"SELECT COUNT(*) FROM capr;").getResults()[0].fetchRow(0).getLong(0); if (count > 10) { try { Thread.sleep(1000); } catch (Exception e2) count = TxnId2Utils.doAdHoc(client,"SELECT COUNT(*) FROM capr;").getResults()[0].fetchRow(0).getLong(0); log.warn("Replicated table CAPR has more rows ("+count+") than the limit set by capped collections (10) retrying in 1 sec"); if ( count > 10 ) { log.error("Replicated table CAPR has more rows ("+count+") than the limit set by capped collections (10)"); ret = true; } } while (partitions.advanceRow()) { long id = partitions.getLong(0); long key = partitions.getLong(1); boolean retry = true; while ( true ) { count = client.callProcedure("CAPPCountPartitionRows",key).getResults()[0].fetchRow(0).getLong(0); if (count > 10 && retry ) { retry = false; log.warn("Replicated table CAPP has more rows ("+count+") than the limit set by capped collections (10) on partition "+id+" , retrying in 1 sec"); try { Thread.sleep(1000); } catch (Exception e2) } else if (count > 10) { log.error("Replicated table CAPP has more rows ("+count+") than the limit set by capped collections (10) on partition "+id); ret = true; break; } else { break; } } } return ret; }

Target:
private boolean exceedsCappedLimit() throws NoConnectionsException, IOException, ProcCallException { VoltTable partitions = client.callProcedure("@GetPartitionKeys", "INTEGER").getResults()[0]; long count = TxnId2Utils.doAdHoc(client,"SELECT COUNT(*) FROM capr;").getResults()[0].fetchRow(0).getLong(0); if (count > 10) { log.warn("CappedTableLoader Replicated table CAPR has more rows ("+count+") than the limit set by capped collections (10) retrying in 1 sec"); try { Thread.sleep(1000); } catch (Exception e2) count = TxnId2Utils.doAdHoc(client,"SELECT COUNT(*) FROM capr;").getResults()[0].fetchRow(0).getLong(0); if ( count > 10 ) { log.error("CappedTableLoader Replicated table CAPR has more rows ("+count+") than the limit set by capped collections (10)"); return(true); } else { log.info("CappedTableLoader Replicated table CAPR has been limited to "+count+" rows"); } } while (partitions.advanceRow()) { long id = partitions.getLong(0); long key = partitions.getLong(1); count = client.callProcedure("CAPPCountPartitionRows",key).getResults()[0].fetchRow(0).getLong(0); if (count > 10) { log.warn("CappedTableLoader Partitioned table CAPP has more rows ("+count+") than the limit set by capped collections (10) on partition "+id+" , retrying in 1 sec"); try { Thread.sleep(1000); } catch (Exception e2) count = client.callProcedure("CAPPCountPartitionRows",key).getResults()[0].fetchRow(0).getLong(0); if (count > 10) { log.error("CappedTableLoader Partitioned table CAPP has more rows ("+count+") than the limit set by capped collections (10) on partition "+id); return(true); } else { log.info("CappedTableLoader Partitioned table CAPP partition "+id+" has been limited to "+count+" rows"); } } } return(false); }
Source:
public static CommitMessageComponentState loadState(Repository repository) { IDialogSettings dialogSettings = getDialogSettings(); String[] values = dialogSettings.getArray(repository.getDirectory() .getAbsolutePath()); if (values == null || values.length < MEMBER_COUNT_WITHOUT_CARET_POSITION) { return null; } CommitMessageComponentState state = new CommitMessageComponentState(); state.setAmend(Boolean.parseBoolean(values[0])); state.setAuthor(values[1]); state.setCommitMessage(values[2]); state.setCommitter(values[3]); state.setHeadCommit(ObjectId.fromString(values[4])); if (values.length == MEMBER_COUNT) { state.setCaretPosition(Integer.parseInt(values[5])); } else if (values.length == MEMBER_COUNT_WITHOUT_CARET_POSITION) { state.setCaretPosition( CommitMessageComponentState.CARET_DEFAULT_POSITION); } return state; }

Target:
public static CommitMessageComponentState loadState(Repository repository) { IDialogSettings dialogSettings = getDialogSettings(); String[] values = dialogSettings.getArray(repository.getDirectory() .getAbsolutePath()); if (values == null || values.length < MEMBER_COUNT_WITHOUT_CARET_POSITION) { return null; } CommitMessageComponentState state = new CommitMessageComponentState(); state.setAmend(Boolean.parseBoolean(values[0])); state.setAuthor(values[1]); state.setCommitMessage(values[2]); state.setCommitter(values[3]); state.setHeadCommit(ObjectId.fromString(values[4])); if (values.length >= MEMBER_COUNT) { state.setCaretPosition(Integer.parseInt(values[5])); } else { state.setCaretPosition( CommitMessageComponentState.CARET_DEFAULT_POSITION); } return state; }
Source:
public Map<String, Object> getBackendHints() { return null; }

Target:
public Map<String, Object> getBackendHints() { return Collections.emptyMap(); }
Source:
public void createTest() { Item milk = createMilk(); assertEquals("milk-bottle", milk.getId()); assertEquals("milk", milk.getName()); assertEquals("Milk in a bottle", milk.getDescription()); assertEquals(Integer.valueOf(1), milk.getWeight()); }

Target:
public void createTest() { Item milk = createMilk(); assertEquals("fmil1", milk.getId()); assertEquals("milk", milk.getName()); assertEquals("Milk in a bottle", milk.getDescription()); assertEquals(Integer.valueOf(1), milk.getWeight()); }
Source:
public void calculateScrollWidth() { if (scrollbar.isAttached()) { double plotWidth = simplePlot.getOffsetWidth() - simplePlot.getOptions().getYAxisOptions().getLabelWidth() - 4; double visibleRange = simplePlot.getAxes().getX().getMaximumValue() - simplePlot.getAxes().getX().getMinimumValue(); double ratio = maxRange / visibleRange; scrollbar.setScrollWidth((int) (plotWidth * ratio)); } }

Target:
public void calculateScrollWidth() { if (scrollbar.isAttached()) { double plotWidth = getPlotWidth() - TOTAL_BORDERS_WIDTH; double visibleRange = getVisibleRange(); double ratio = maxRange / visibleRange; scrollbar.setScrollWidth((int) (plotWidth * ratio)); } }
Source:
public void testDataProviderWithOutOfBoundIndex() { VirtualTableQueryFilter queryFilter = new EventTableQueryFilter(Collections.emptyList(), 2000000, 5, null); TmfModelResponse<ITmfVirtualTableModel<EventTableLine>> response = fProvider.fetch(queryFilter, null); ITmfVirtualTableModel<EventTableLine> currentModel = response.getModel(); List<Long> expectedColumnsId = Arrays.asList(TIMESTAMP_COLUMN_ID, EVENT_TYPE_COLUMN_ID, CONTENTS_COLUMN_ID); assertNotNull(currentModel); assertEquals(expectedColumnsId, currentModel.getColumnsIds()); assertTrue(currentModel.getData().isEmpty()); }

Target:
public void testDataProviderWithOutOfBoundIndex() { VirtualTableQueryFilter queryFilter = new EventTableQueryFilter(Collections.emptyList(), 2000000, 5, null); TmfModelResponse<ITmfVirtualTableModel<EventTableLine>> response = fProvider.fetchLines(queryFilter, null); ITmfVirtualTableModel<EventTableLine> currentModel = response.getModel(); assertNotNull(currentModel); assertEquals(fColumnId, currentModel.getColumnsIds()); assertTrue(currentModel.getData().isEmpty()); }
Source:
public static Map<String, Set<IType>> createAQLVariableTypesFromInterpreterContext(IInterpreterContext context, IQueryEnvironment queryEnvironment) { Map<String, Set<IType>> variableTypes = new LinkedHashMap<String, Set<IType>>(); final Set<IType> selfTyping = new LinkedHashSet<IType>(2); for (String targetType : context.getTargetTypes()) { EClassifier found = null; int separatorPosition = targetType.indexOf('.'); if (separatorPosition > -1) { String typeName = targetType.substring(separatorPosition + 1); String nsPrefix = targetType.substring(0, separatorPosition); found = queryEnvironment.getEPackageProvider().getType(nsPrefix, typeName); } else { found = queryEnvironment.getEPackageProvider().getType(targetType); } if (found != null) { selfTyping.add(new EClassifierType(found)); } } if (selfTyping.size() == 0) { selfTyping.add(new ClassType(EObject.class)); } variableTypes.put("self", selfTyping); for (Entry<String, String> varDef : context.getVariables().entrySet()) { String typeDescription = varDef.getValue(); int indexOfSeparator = typeDescription.indexOf('.'); if (indexOfSeparator > -1) { String nsPrefix = typeDescription.substring(0, indexOfSeparator); String typeName = typeDescription.substring(indexOfSeparator + 1); EClassifier found = queryEnvironment.getEPackageProvider().getType(nsPrefix, typeName); if (found != null) { final Set<IType> potentialTypes = new LinkedHashSet<IType>(2); potentialTypes.add(new EClassifierType(found)); variableTypes.put(varDef.getKey(), potentialTypes); } } } return variableTypes; }

Target:
public static Map<String, Set<IType>> createAQLVariableTypesFromInterpreterContext(IInterpreterContext context, IQueryEnvironment queryEnvironment) { Map<String, Set<IType>> variableTypes = new LinkedHashMap<String, Set<IType>>(); final Set<IType> selfTyping = new LinkedHashSet<IType>(2); for (String targetTypeName : context.getTargetTypes()) { EClassifierType found = searchEClassifierType(queryEnvironment, targetTypeName); if (found != null) { selfTyping.add(found); } } if (selfTyping.size() == 0) { selfTyping.add(new ClassType(EObject.class)); } variableTypes.put("self", selfTyping); for (Entry<String, String> varDef : context.getVariables().entrySet()) { String typeName = varDef.getValue(); if (typeName != null) { EClassifierType found = searchEClassifierType(queryEnvironment, typeName); if (found != null) { final Set<IType> potentialTypes = new LinkedHashSet<IType>(2); potentialTypes.add(found); variableTypes.put(varDef.getKey(), potentialTypes); } } } return variableTypes; }