auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public static org.kie.dmn.model.api.OutputClause dmnFromWB(final OutputClause wb) { org.kie.dmn.model.api.OutputClause result = new org.kie.dmn.model.v1_2.TOutputClause(); result.setId(wb.getId().getValue()); result.setName(wb.getName()); result.setDescription(DescriptionPropertyConverter.dmnFromWB(wb.getDescription())); UnaryTests outputValues = UnaryTestsPropertyConverter.dmnFromWB(wb.getOutputValues()); <START> if (outputValues != null && !outputValues.getText().isEmpty()) { <END> outputValues.setParent(result); result.setOutputValues(outputValues); } LiteralExpression defaultOutputEntry = LiteralExpressionPropertyConverter.dmnFromWB(wb.getDefaultOutputEntry()); if (defaultOutputEntry != null && !defaultOutputEntry.getText().isEmpty()) { defaultOutputEntry.setParent(result); result.setDefaultOutputEntry(defaultOutputEntry); } QNamePropertyConverter.setDMNfromWB(wb.getTypeRef(), result::setTypeRef); return result; }</code><technical_language>org.kie.workbench.common.stunner.core.util.StringUtils.nonEmpty(..) (but know!?!)</technical_language>

Target:
public static org.kie.dmn.model.api.OutputClause dmnFromWB(final OutputClause wb) { org.kie.dmn.model.api.OutputClause result = new org.kie.dmn.model.v1_2.TOutputClause(); result.setId(wb.getId().getValue()); result.setName(wb.getName()); result.setDescription(DescriptionPropertyConverter.dmnFromWB(wb.getDescription())); UnaryTests outputValues = UnaryTestsPropertyConverter.dmnFromWB(wb.getOutputValues()); if (outputValues != null && StringUtils.nonEmpty(outputValues.getText())) { outputValues.setParent(result); result.setOutputValues(outputValues); } LiteralExpression defaultOutputEntry = LiteralExpressionPropertyConverter.dmnFromWB(wb.getDefaultOutputEntry()); if (defaultOutputEntry != null && StringUtils.nonEmpty(defaultOutputEntry.getText())) { defaultOutputEntry.setParent(result); result.setDefaultOutputEntry(defaultOutputEntry); } QNamePropertyConverter.setDMNfromWB(wb.getTypeRef(), result::setTypeRef); return result; }
Source:
<code>private ExactPredicate[] getAllPropertyValues( KernelStatement state, SchemaDescriptor schema, NodeItem node ) { int[] propertyIds = schema.getPropertyIds(); ExactPredicate[] values = new ExactPredicate[propertyIds.length]; for ( int i = 0; i < values.length; i++ ) { <START> Object value = nodeGetProperty( state, node, propertyIds[i] ); <END> if ( value == null ) { return null; } values[i] = IndexQuery.exact( propertyIds[i], value ); } return values; }</code><technical_language>I faster implement this in terms of Cursor<PropertyItem> nodeGetProperties</technical_language>

Target:
private ExactPredicate[] getAllPropertyValues( KernelStatement state, SchemaDescriptor schema, NodeItem node ) { int[] propertyIds = schema.getPropertyIds(); ExactPredicate[] values = new ExactPredicate[propertyIds.length]; int nMatched = 0; Cursor<PropertyItem> nodePropertyCursor = nodeGetProperties( state, node ); while ( nodePropertyCursor.next() ) { PropertyItem property = nodePropertyCursor.get(); int k = ArrayUtils.indexOf( propertyIds, property.propertyKeyId() ); if ( k >= 0 ) { values[k] = IndexQuery.exact( property.propertyKeyId(), property.value() ); nMatched++; } } if ( nMatched < values.length ) { return null; } return values; }
Source:
<code>public void baseEventProcessingTest() throws Exception { EmbeddedAgent agent = new EmbeddedAgent("test-flume"); Properties properties = getProperties(System.getProperty(CONFIG_NAME)); String authPath = properties.getProperty(AUTH_PROPERTIES); if (authPath != null) { URL url = Thread.currentThread().getContextClassLoader().getResource(authPath); properties.setProperty(AUTH_PROPERTIES, url.getPath()); } Map propertyMap = new HashMap<String, String>(); for (final String name : properties.stringPropertyNames()) { propertyMap.put(name, properties.getProperty(name)); } agent.configure(propertyMap); agent.start(); long startTime = System.currentTimeMillis(); for (int i = 0; i < eventNumber; i++) { Event event = new SimpleEvent(); event.setBody((EVENT_STR + i).getBytes()); agent.put(event); } Thread.currentThread().sleep(1000); agent.stop(); HttpResponse response = readFromStream(properties, startTime, System.currentTimeMillis()); JSONArray jsonArray = new JSONArray(EntityUtils.toString(response.getEntity())); <START> for (int i = 0; i < eventNumber; i++) { <END> Assert.assertTrue(jsonArray.getJSONObject(i).getString(RESPONSE_EVENT_BODY).equals(EVENT_STR + i)); } }</code><technical_language>Assert.assertEquals(eventNumber, jsonArray.size()) good here</technical_language>

Target:
public void baseEventProcessingTest() throws Exception { EmbeddedAgent agent = new EmbeddedAgent("test-flume"); Map propertyMap = new HashMap<String, String>(); for (final String name : flumeProperties.stringPropertyNames()) { propertyMap.put(name, flumeProperties.getProperty(name)); } agent.configure(propertyMap); agent.start(); long startTime = System.currentTimeMillis(); writeEvents(agent, 0, EVENT_NUMBER); Thread.sleep(SLEEP_INTERVAL); agent.stop(); checkDeliveredEvents(flumeProperties, startTime, System.currentTimeMillis()); }
Source:
<code>public void testParquetTupleDomainMap() { HiveColumnHandle colHandle = new HiveColumnHandle("my_map", HiveType.valueOf("map<int,int>"), parseTypeSignature(StandardTypes.MAP), 0, REGULAR, Optional.empty()); MapType mapType = new MapType( INTEGER, INTEGER, <START> MethodHandleUtil.methodHandle(TestParquetPredicateUtils.class, "throwUnsupportedOperation"), <END> MethodHandleUtil.methodHandle(TestParquetPredicateUtils.class, "throwUnsupportedOperation"), MethodHandleUtil.methodHandle(TestParquetPredicateUtils.class, "throwUnsupportedOperation")); TupleDomain<HiveColumnHandle> domain = TupleDomain.withColumnDomains(ImmutableMap.of(colHandle, Domain.notNull(mapType))); MessageType fileSchema = new MessageType("hive_schema", new GroupType(OPTIONAL, "my_map", new GroupType(REPEATED, "map", new PrimitiveType(REQUIRED, INT32, "key"), new PrimitiveType(OPTIONAL, INT32, "value")))); TupleDomain<ColumnDescriptor> tupleDomain = getParquetTupleDomain(fileSchema, fileSchema, domain); assertTrue(tupleDomain.getDomains().get().isEmpty()); }</code><technical_language>static import methodHandle</technical_language>

Target:
public void testParquetTupleDomainMap() { HiveColumnHandle columnHandle = new HiveColumnHandle("my_map", HiveType.valueOf("map<int,int>"), parseTypeSignature(StandardTypes.MAP), 0, REGULAR, Optional.empty()); MapType mapType = new MapType( INTEGER, INTEGER, methodHandle(TestParquetPredicateUtils.class, "throwUnsupportedOperationException"), methodHandle(TestParquetPredicateUtils.class, "throwUnsupportedOperationException"), methodHandle(TestParquetPredicateUtils.class, "throwUnsupportedOperationException")); TupleDomain<HiveColumnHandle> domain = TupleDomain.withColumnDomains(ImmutableMap.of(columnHandle, Domain.notNull(mapType))); MessageType fileSchema = new MessageType("hive_schema", new GroupType(OPTIONAL, "my_map", new GroupType(REPEATED, "map", new PrimitiveType(REQUIRED, INT32, "key"), new PrimitiveType(OPTIONAL, INT32, "value")))); TupleDomain<ColumnDescriptor> tupleDomain = getParquetTupleDomain(fileSchema, fileSchema, domain); assertTrue(tupleDomain.getDomains().get().isEmpty()); }
Source:
<code>public boolean removePassenger(Entity passenger) { <START> Preconditions.checkArgument(passenger != this, "Entity cannot ride itself."); <END> if (passenger == null || !passengers.contains(passenger)) return false; if (EventFactory.callEvent(new EntityDismountEvent(passenger, this)).isCancelled()) { return false; } if (!(passenger instanceof GlowEntity)) { return false; } GlowEntity glowPassenger = (GlowEntity) passenger; passengerChanged = true; glowPassenger.vehicle = null; return passengers.remove(passenger); }</code><technical_language>Replace passenger != this !Objects.equals(passenger, this)</technical_language>

Target:
public boolean removePassenger(Entity passenger) { Preconditions.checkArgument(!this.equals(passenger), "Entity cannot ride itself."); if (passenger == null || !passengers.contains(passenger)) return false; if (EventFactory.callEvent(new EntityDismountEvent(passenger, this)).isCancelled()) { return false; } if (!(passenger instanceof GlowEntity)) { return false; } GlowEntity glowPassenger = (GlowEntity) passenger; passengerChanged = true; glowPassenger.vehicle = null; glowPassenger.teleport(getDismountLocation()); return passengers.remove(passenger); }
Source:
<code>public Observable<PersistentResource> export(AsyncQuery query) { Observable<PersistentResource> results = Observable.empty(); UUID requestId = UUID.fromString(query.getRequestId()); try (DataStoreTransaction tx = elide.getDataStore().beginTransaction()) { elide.getTransactionRegistry().addRunningTransaction(requestId, tx); EntityProjection projection = null; RequestScope requestScope = null; if (query.getQueryType().equals(QueryType.GRAPHQL_V1_0)) { projection = graphQLParser.parse(query); requestScope = new GraphQLRequestScope("", tx, user, apiVersion, elide.getElideSettings(), null, requestId); } else { throw new InvalidValueException("QueryType not supported"); } if (projection != null) { results = PersistentResource.loadRecords(projection, Collections.emptyList(), requestScope); } tx.preCommit(); requestScope.runQueuedPreSecurityTriggers(); requestScope.getPermissionExecutor().executeCommitChecks(); tx.flush(requestScope); requestScope.runQueuedPreCommitTriggers(); elide.getAuditLogger().commit(); tx.commit(requestScope); requestScope.runQueuedPostCommitTriggers(); } catch (IOException e) { <START> throw new IllegalStateException(e); <END> } finally { elide.getTransactionRegistry().removeRunningTransaction(requestId); elide.getAuditLogger().clear(); } return results; }</code><technical_language>IOExceptions handled throwing a TransactionException in Elide. consistent here</technical_language>

Target:
public Observable<PersistentResource> export(AsyncQuery query) { Observable<PersistentResource> results = Observable.empty(); UUID requestId = UUID.fromString(query.getRequestId()); try (DataStoreTransaction tx = elide.getDataStore().beginTransaction()) { elide.getTransactionRegistry().addRunningTransaction(requestId, tx); EntityProjection projection = null; RequestScope requestScope = null; if (query.getQueryType().equals(QueryType.GRAPHQL_V1_0)) { projection = graphQLParser.parse(query); requestScope = new GraphQLRequestScope("", tx, user, apiVersion, elide.getElideSettings(), null, requestId); } else { throw new InvalidValueException("QueryType not supported"); } if (projection != null) { results = PersistentResource.loadRecords(projection, Collections.emptyList(), requestScope); } tx.preCommit(); requestScope.runQueuedPreSecurityTriggers(); requestScope.getPermissionExecutor().executeCommitChecks(); tx.flush(requestScope); requestScope.runQueuedPreCommitTriggers(); elide.getAuditLogger().commit(); tx.commit(requestScope); requestScope.runQueuedPostCommitTriggers(); } catch (IOException e) { log.error("IOException during TableExport", e); throw new TransactionException(e); } finally { elide.getTransactionRegistry().removeRunningTransaction(requestId); elide.getAuditLogger().clear(); } return results; }
Source:
<code>public abstract void setFlags(List<? extends Message> messages, Set<Flag> flags, boolean value) throws MessagingException; public abstract void setFlags(Set<Flag> flags, boolean value) throws MessagingException; public abstract String getUidFromMessageId(Message message) throws MessagingException; <START> public void expunge(List<Long> knownDeletedUids) throws MessagingException <END> {}</code><technical_language>Folder abstraction UIDs opaque strings. UIDs numbers is implementation detail of ImapFolder. replace this interface more flexible this interface clean. Also, (e.g. emptying Trash folder) unconstrained EXPUNGE sense. original method add a new describes is about. suggestion: java public void expungeUids(List<String> uids) throws MessagingException</technical_language>

Target:
public abstract void setFlags(List<? extends Message> messages, Set<Flag> flags, boolean value) throws MessagingException; public abstract void setFlags(Set<Flag> flags, boolean value) throws MessagingException; public abstract String getUidFromMessageId(Message message) throws MessagingException; public void expunge() throws MessagingException
Source:
<code>public boolean canHandleArtifact(T artifact) { try { <START> @SuppressWarnings("rawtypes") <END> Class<?> genericType = ((Class) ((ParameterizedType) this.getClass().getGenericSuperclass()) .getActualTypeArguments()[0]); return genericType.isAssignableFrom(artifact.getClass()); } catch (NoClassDefFoundError e) { return false; } }</code><technical_language>This is necessary if cast is Class<?></technical_language>

Target:
public boolean canHandleArtifact(T artifact) { try { Class<?> genericType = ((Class<?>) ((ParameterizedType) this.getClass().getGenericSuperclass()) .getActualTypeArguments()[0]); return genericType.isAssignableFrom(artifact.getClass()); } catch (NoClassDefFoundError e) { return false; } }
Source:
<code>private void drain() { if (wip.getAndIncrement() == 0) { final Subscriber<? super T> c = child; final Queue<Object> q = queue; do { if (checkTerminated(done, q.isEmpty())) { return; } wip.lazySet(1); long r = get(); long e = 0; while (r != 0) { boolean d = done; Object v = q.poll(); if (checkTerminated(d, v == null)) { return; } else if (v == null) { break; } try { if (v == NULL_SENTINEL) { c.onNext(null); } else { @SuppressWarnings("unchecked") T t = (T)v; c.onNext(t); } } catch (Throwable ex) { Exceptions.throwIfFatal(ex); Throwable ex1 = OnErrorThrowable.addValueAsLastCause(ex, v != NULL_SENTINEL ? v : null); c.onError(ex1); return; } r--; e++; } <START> if (e != 0) { <END> addAndGet(-e); } } while (wip.decrementAndGet() != 0); } }</code><technical_language>&& get() != Long.MAX_VALUE</technical_language>

Target:
private void drain() { if (wip.getAndIncrement() == 0) { final Subscriber<? super T> c = child; final Queue<Object> q = queue; do { if (checkTerminated(done, q.isEmpty())) { return; } wip.lazySet(1); long r = get(); long e = 0; while (r != 0) { boolean d = done; Object v = q.poll(); if (checkTerminated(d, v == null)) { return; } else if (v == null) { break; } try { if (v == NULL_SENTINEL) { c.onNext(null); } else { @SuppressWarnings("unchecked") T t = (T)v; c.onNext(t); } } catch (Throwable ex) { Exceptions.throwIfFatal(ex); Throwable ex1 = OnErrorThrowable.addValueAsLastCause(ex, v != NULL_SENTINEL ? v : null); c.onError(ex1); return; } r--; e++; } if (e != 0 && get() != Long.MAX_VALUE) { addAndGet(-e); } } while (wip.decrementAndGet() != 0); } }
Source:
<code>public void onActivityCreated(Bundle savedInstanceState) { <START> super.onActivityCreated(savedInstanceState); <END> setHasOptionsMenu(true); adapter = new RandomAdapter(getActivity(), new ArrayList<PageTitle>()); randomList.setAdapter(adapter); randomList.setOnItemClickListener(new AdapterView.OnItemClickListener() { @Override public void onItemClick(AdapterView<?> parent, View view, int position, long id) { PageTitle title = adapter.getItem(position); HistoryEntry newEntry = new HistoryEntry(title, HistoryEntry.SOURCE_RANDOM); ((PageActivity) getActivity()).displayNewPage(title, newEntry); } }); fetchRandomArticles(); }</code><technical_language>Food for thought: user clicks visiting a random article here, do want show random results leaving this fragment? a new set of random results</technical_language>

Target:
public void onActivityCreated(Bundle savedInstanceState) { super.onActivityCreated(savedInstanceState); setHasOptionsMenu(true); adapter = new RandomAdapter(getActivity(), new ArrayList<RandomPage>()); randomList.setAdapter(adapter); randomList.setOnItemClickListener(new AdapterView.OnItemClickListener() { @Override public void onItemClick(AdapterView<?> parent, View view, int position, long id) { PageTitle title = adapter.getItem(position).getPageTitle(); HistoryEntry newEntry = new HistoryEntry(title, HistoryEntry.SOURCE_RANDOM); ((PageActivity) getActivity()).displayNewPage(title, newEntry); } }); fetchRandomArticles(); }
Source:
<code>public void testCreate() throws StripeException { List<String> attributes = new LinkedList<String>(); attributes.add("attr1"); attributes.add("attr2"); Map<String, Object> packageDimensions = new HashMap<String, Object>(); packageDimensions.put("height", 2.234); packageDimensions.put("length", 5.10); packageDimensions.put("width", 6.50); packageDimensions.put("weight", 10); Map<String, Object> params = new HashMap<String, Object>(); params.put("active", true); params.put("name", "Test Name"); params.put("description", "This is a description"); params.put("caption", "This is a caption"); params.put("attributes", attributes); params.put("url", "<LINK_0>"); params.put("shippable", true); params.put("package_dimensions", packageDimensions); params.put("type", "good"); final Product product = Product.create(params); assertNotNull(product); verifyRequest( APIResource.RequestMethod.POST, <START> "/v1/products", <END> params ); }</code><technical_language>called resource</technical_language>

Target:
public void testCreate() throws StripeException { final List<String> attributes = new LinkedList<String>(); attributes.add("attr1"); attributes.add("attr2"); final Map<String, Object> packageDimensions = new HashMap<String, Object>(); packageDimensions.put("height", 2.234); packageDimensions.put("length", 5.10); packageDimensions.put("width", 6.50); packageDimensions.put("weight", 10); final Map<String, Object> params = new HashMap<String, Object>(); params.put("active", true); params.put("name", "Test Name"); params.put("description", "This is a description"); params.put("caption", "This is a caption"); params.put("attributes", attributes); params.put("url", "<LINK_0>"); params.put("shippable", true); params.put("package_dimensions", packageDimensions); params.put("type", "good"); final Product product = Product.create(params); assertNotNull(product); verifyRequest( APIResource.RequestMethod.POST, "/v1/products", params ); }
Source:
<code>public SSLClient(String host, int port) throws IOException { super(host, port); try { long start = System.currentTimeMillis(); ssle = OPEN_SSL_CTX.createSSLEngine(host, port); ssle.setUseClientMode(true); <START> System.out.println("HS:"+ (System.currentTimeMillis()-start)); <END> doHandShake(); } catch (Exception e) { throw new IOException(SSL_ERROR, e); } super.setReader(this); encryptedReadBuffer = ByteBuffer.allocate(ssle.getSession().getPacketBufferSize()); }</code><technical_language>I avoid System.currentTimeMillis...I Clock.accurateTimeMillis() alternative I try avoid System.out. System.err...a logger a more configurable option. network library _work_ I set level fine finer something. work, this is I logging in threadly library. job of others debug application</technical_language>

Target:
public SSLClient(String host, int port) throws IOException { this(host, port, OPEN_SSL_CTX.createSSLEngine(host, port)); }
Source:
<code>void onCreate() { if (prefs.getBoolean("first-run-shortcuts", true) && ShortcutUtil.areShortcutsEnabled(mainActivity)) { <START> ShortcutUtil.buildShortcuts(mainActivity); <END> prefs.edit().putBoolean("first-run-shortcuts", false).apply(); } }</code><technical_language>I name is slightly ambiguous, this remove shortcuts recreate them. rebuildShortcuts()? reinitializeShortcuts()</technical_language>

Target:
void onCreate() { if (prefs.getBoolean("first-run-shortcuts", true) && ShortcutUtil.areShortcutsEnabled(mainActivity)) { ShortcutUtil.rebuildShortcuts(mainActivity); prefs.edit().putBoolean("first-run-shortcuts", false).apply(); } }
Source:
<code>synchronized void setForumSelection(final String forumSelection) { this.forumSelection = Optional.ofNullable(forumSelection) .filter(Predicate.not(String::isBlank)) .orElse(getForumSelectionOptions().iterator().next()); Postconditions.assertState( this.forumSelection != null && !this.forumSelection.isBlank(), "Forum selection is driven by a drop-down to ensure user can never set it to null, " + "if setting to null from a game properties, we default to the first available " + "selection entry, forum selection should never be null or empty."); forumUsername = this.forumSelection.equals(NodeBbForumPoster.TRIPLEA_FORUM_DISPLAY_NAME) ? ClientSetting.tripleaForumUsername.getValue().map(String::valueOf).orElse("") : ClientSetting.aaForumUsername.getValue().map(String::valueOf).orElse(""); <START> forumPasswordIsSet = false; readyCallback.run(); }</code><technical_language>If I understand correctly, 'username' + 'password' create a token API, store token password (correct?). If so, I want this field check if token is set. If token is set, fill in password field a dummy is filled in (that essentially - reason for is read password settings set actual text field. Instead a dummy string show field is set)</technical_language>

Target:
synchronized void setForumSelection(final String forumSelection) { this.forumSelection = Optional.ofNullable(forumSelection) .filter(Predicate.not(String::isBlank)) .orElse(getForumSelectionOptions().iterator().next()); Postconditions.assertState( this.forumSelection != null && !this.forumSelection.isBlank(), "Forum selection is driven by a drop-down to ensure user can never set it to null, " + "if setting to null from a game properties, we default to the first available " + "selection entry, forum selection should never be null or empty."); forumUsername = this.forumSelection.equals(NodeBbForumPoster.TRIPLEA_FORUM_DISPLAY_NAME) ? ClientSetting.tripleaForumUsername.getValue().map(String::valueOf).orElse("") : ClientSetting.aaForumUsername.getValue().map(String::valueOf).orElse(""); forumTokenExists = getTokenSetting().getValue().map(token -> token.length > 0).orElse(false); readyCallback.run(); }
Source:
<code><START> private void tryLock(String path) { <END> if (_zkBaseDataAccessor.exists(path + "/" + WRITE_LOCK_KEY, AccessOption.EPHEMERAL)) { throw new HelixException( String.format("There is already a write in progress for path: %s", path)); } }</code><technical_language>tryLock return a boolean instead of throwing exceptions</technical_language>

Target:
private boolean tryLock(String path) { return !_zkBaseDataAccessor.exists(path + "/" + WRITE_LOCK_KEY, AccessOption.EPHEMERAL) && _zkBaseDataAccessor.set(path + "/" + WRITE_LOCK_KEY, new byte[0], AccessOption.EPHEMERAL); }
Source:
<code>public void run() { try { if(prjSave == null) { String remoteServices = fConn.getSshSettings().getRemoteServices(); IRemoteServices services = RemoteServices.getRemoteServices(remoteServices); if (services != null) { IRemoteConnectionManager connMgr = services.getConnectionManager(); if (connMgr != null) { fRemoteConnection = connMgr.getConnection(fConn.getSshSettings().getConnectionName()); } } } else { fRemoteConnection = Util.getRemoteConnection(prjSave); } if (fRemoteConnection != null && !fRemoteConnection.isOpen()) { try { fRemoteConnection.open(null); } catch (RemoteConnectionException e) { Activator.log(e); } } <START> if(fRemoteConnection != null || !fRemoteConnection.isOpen()) { <END> TerminalPlugin plugin = TerminalPlugin.getDefault(); IPreferenceStore preferenceStore = plugin.getPreferenceStore(); final boolean[] done = new boolean[]{false}; fConn.setupHistoryMonitoring(this, preferenceStore,done); try { readDataForever(fConn.getInputStream()); } catch (InterruptedIOException e) { } finally { done[0] = true; } } } catch (IOException e) { fControl.setState(TerminalState.CLOSED); } finally { try { disconnect(); } finally { fControl.setState(TerminalState.CLOSED); } } }</code><technical_language>conditions for proceeding, be: if(fRemoteConnection != null && fRemoteConnection.isOpen())</technical_language>

Target:
public void run() { try { if(prjSave == null) { String remoteServices = fConn.getSshSettings().getRemoteServices(); IRemoteServices services = RemoteServices.getRemoteServices(remoteServices); if (services != null) { IRemoteConnectionManager connMgr = services.getConnectionManager(); if (connMgr != null) { fRemoteConnection = connMgr.getConnection(fConn.getSshSettings().getConnectionName()); } } } else { fRemoteConnection = Util.getRemoteConnection(prjSave); } if (fRemoteConnection != null && !fRemoteConnection.isOpen()) { try { fRemoteConnection.open(null); } catch (RemoteConnectionException e) { Activator.log(e); } } if(fRemoteConnection != null && fRemoteConnection.isOpen()) { TerminalPlugin plugin = TerminalPlugin.getDefault(); IPreferenceStore preferenceStore = plugin.getPreferenceStore(); setupHistoryMonitoring(fConn, preferenceStore); try { readDataForever(fConn.getInputStream()); } catch (InterruptedIOException e) { } } } catch (IOException e) { fControl.setState(TerminalState.CLOSED); } finally { try { disconnect(); } finally { fControl.setState(TerminalState.CLOSED); } } }
Source:
<code>public final void initialize(final URL location, final ResourceBundle resources) { listen(Message.OPENED, (controller, args) -> { assert controller instanceof MenuController; final int expectedLength = 3; assert args.length == expectedLength; assert args[2] instanceof File; try { loadTree((File) args[2]); } catch (FileNotFoundException e) { Logging.exception(e); } }); listen(Message.LOADED, (controller, args) -> { if (controller instanceof GraphController) { assert args[0] instanceof Graph; assert (args[1] instanceof Map<?, ?>); sequences = (Map<String, Sequence>) args[1]; repaint(); } }); listen(Message.FILTERED, (controller, args) -> { assert args.length == 1; <START> if (!(args[0] instanceof Set<?>)) { <END> throw new IllegalArgumentException( "Argument not of type Set<Sequence>"); } if (!(controller instanceof TreeController)) { setVisible((Set<Sequence>) args[0]); } }); view.setController(this); }</code><technical_language>assertmight</technical_language>

Target:
public final void initialize(final URL location, final ResourceBundle resources) { listen(Message.OPENED, (controller, args) -> { assert controller instanceof MenuController; final int expectedLength = 3; assert args.length == expectedLength; assert args[2] instanceof File; try { loadTree((File) args[2]); } catch (FileNotFoundException e) { Logging.exception(e); } }); listen(Message.LOADED, (controller, args) -> { if (controller instanceof GraphController) { assert args[0] instanceof Graph; assert (args[1] instanceof Map<?, ?>); sequences = (Map<String, Sequence>) args[1]; repaint(); } }); listen(Message.FILTERED, (controller, args) -> { assert args.length == 1; assert (args[0] instanceof Set<?>); if (!(controller instanceof TreeController)) { setVisible((Set<Sequence>) args[0]); } }); view.setController(this); }
Source:
<code>public static Injector getInjector() { if ( injector == null ) { <START> injector = Guice.createInjector( new GuiceModule( emf ) ); <END> } return injector; }</code><technical_language>Do need do this here? This creating a circular dependency of EMF Guice, EMF depends Guice</technical_language>

Target:
public static Injector getInjector() { if ( injector == null ) { injector = Guice.createInjector( new GuiceModule() ); } return injector; }
Source:
<code><START> public void testsHeaderAvailable() throws IOException { <END> MatcherAssert.assertThat( new RqFake( Arrays.asList( "GET /f?a=3&b-6", "Host: example.com", "Accept: text/xml", "Accept: text/html" ), "" ), new HmRqHeader(Matchers.hasEntry("accept", "text/xml")) ); }</code><technical_language>@ekondrashev declare throws Exception [coding standards](www.yegor256.com/2014/04/27/typical-mistakes-in-java-code.html#test-method-names)</technical_language>

Target:
public void testsHeaderAvailable() throws Exception { MatcherAssert.assertThat( new RqFake( Arrays.asList( "GET /f?a=3&b-6", "Host: example.com", "Accept: text/xml", "Accept: text/html" ), "" ), new HmRqHeader(Matchers.hasEntry("accept", "text/xml")) ); }
Source:
<code>private String getUserAgentFixedPart() { String osName = System.getProperty("os.name"); if (osName == null) { osName = "Unknown"; } osName = osName.replaceAll("\\s", ""); String geteUserAgentFixedPart = <START> UserAgentContainer.AZSDK_USERAGENT_PREFIX + <END> "cosmos" + "/" + HttpConstants.Versions.SDK_VERSION + SPACE + osName + "/" + System.getProperty("os.version") + SPACE + "JRE/" + System.getProperty("java.version"); return geteUserAgentFixedPart; }</code><technical_language>please replace UserAgentContainer.AZSDK_USERAGENT_PREFIX hard coded for test</technical_language>

Target:
private String getUserAgentFixedPart() { String osName = System.getProperty("os.name"); if (osName == null) { osName = "Unknown"; } osName = osName.replaceAll("\\s", ""); String geteUserAgentFixedPart = "azsdk-java-" + "cosmos" + "/" + HttpConstants.Versions.SDK_VERSION + SPACE + osName + "/" + System.getProperty("os.version") + SPACE + "JRE/" + System.getProperty("java.version"); return geteUserAgentFixedPart; }
Source:
<code>public void testInitialValuesUpdateTestCaseStartedEvent() throws Exception { AnnotationManager annotationManager = setAnnotationManager("simpleMethod"); TestCaseStartedEvent event = new TestCaseStartedEvent("some.uid", "some.name"); annotationManager.update(event); assertThat(event.getTitle(), equalTo("some.title")); Description description = annotationManager.getDescription(); assertThat(description.getValue(), is("some.description")); assertThat(description.getType(), is(DescriptionType.TEXT)); <START> assertTrue(event.getLabels().contains(createStoryLabel("some.story"))); <END> assertTrue(event.getLabels().contains(createFeatureLabel("some.feature"))); assertTrue(event.getLabels().contains(createSeverityLabel(SeverityLevel.BLOCKER))); assertTrue(event.getLabels().contains(createIssueLabel("some.simple.issue"))); assertTrue(event.getLabels().contains(createIssueLabel("some.nested.issue.1"))); assertTrue(event.getLabels().contains(createIssueLabel("some.nested.issue.2"))); }</code><technical_language>assertThat(event.getLabels(), hasItems(item1, item2...)); More info: [Hamcrest](<LINK_0> more easy maintain tests usage of matchers</technical_language>

Target:
public void testInitialValuesUpdateTestCaseStartedEvent() throws Exception { AnnotationManager annotationManager = setAnnotationManager("simpleMethod"); TestCaseStartedEvent event = new TestCaseStartedEvent("some.uid", "some.name"); annotationManager.update(event); assertThat(event.getTitle(), equalTo("some.title")); Description description = annotationManager.getDescription(); assertThat(description.getValue(), is("some.description")); assertThat(description.getType(), is(DescriptionType.TEXT)); assertThat(event.getLabels(), hasItems( createStoryLabel("some.story"), createFeatureLabel("some.feature"), createSeverityLabel(SeverityLevel.BLOCKER), createIssueLabel("some.simple.issue"), createIssueLabel("some.nested.issue.1"), createIssueLabel("some.nested.issue.2") )); }
Source:
<code>public void testJdbcComputePushdownAll() { String table = "test_table"; String schema = "test_schema"; String predicate = "(c1 + c2) - c2"; TypeProvider typeProvider = TypeProvider.copyOf(ImmutableMap.of("c1", BIGINT, "c2", BIGINT)); RowExpression rowExpression = sqlToRowExpressionTranslator.translateAndOptimize(expression(predicate), typeProvider); Set<ColumnHandle> columns = Arrays.asList("c1", "c2").stream().map(TestJdbcComputePushdown::intJdbcColumnHandle).collect(Collectors.toSet()); PlanNode original = filter(jdbcTableScan(schema, table, "c1", "c2"), rowExpression); JdbcTableHandle jdbcTableHandle = new JdbcTableHandle(CONNECTOR_ID, new SchemaTableName(schema, table), CATALOG_NAME, schema, table); JdbcTableLayoutHandle jdbcTableLayoutHandle = new JdbcTableLayoutHandle(jdbcTableHandle, TupleDomain.none(), Optional.of(new JdbcSql("'c1' + 'c2' - 'c2'"))); ConnectorSession session = new TestingConnectorSession(ImmutableList.of()); PlanNode actual = this.jdbcComputePushdown.optimize(original, session, null, ID_ALLOCATOR); <START> assertPlanMatch(actual, PlanMatchPattern.filter( <END> predicate, JdbcTableScanMatcher.jdbcTableScanPattern(jdbcTableLayoutHandle, columns))); }</code><technical_language>param a line</technical_language>

Target:
public void testJdbcComputePushdownAll() { String table = "test_table"; String schema = "test_schema"; String expression = "(c1 + c2) - c2"; TypeProvider typeProvider = TypeProvider.copyOf(ImmutableMap.of("c1", BIGINT, "c2", BIGINT)); RowExpression rowExpression = sqlToRowExpressionTranslator.translateAndOptimize(expression(expression), typeProvider); Set<ColumnHandle> columns = Stream.of("c1", "c2").map(TestJdbcComputePushdown::integerJdbcColumnHandle).collect(Collectors.toSet()); PlanNode original = filter(jdbcTableScan(schema, table, BIGINT, "c1", "c2"), rowExpression); JdbcTableHandle jdbcTableHandle = new JdbcTableHandle(CONNECTOR_ID, new SchemaTableName(schema, table), CATALOG_NAME, schema, table); JdbcTableLayoutHandle jdbcTableLayoutHandle = new JdbcTableLayoutHandle(jdbcTableHandle, TupleDomain.none(), Optional.of(new JdbcExpression("(('c1' + 'c2') - 'c2')"))); ConnectorSession session = new TestingConnectorSession(ImmutableList.of()); PlanNode actual = this.jdbcComputePushdown.optimize(original, session, null, ID_ALLOCATOR); assertPlanMatch( actual, PlanMatchPattern.filter(expression, JdbcTableScanMatcher.jdbcTableScanPattern(jdbcTableLayoutHandle, columns))); }
Source:
<code>public void setUp() throws Exception { Script script = BrickTestUtils.createProjectAndGetStartScript("WhenBrickTest"); script.addBrick(new PlaceAtBrick()); whenBrickMap.put(R.string.brick_when_started,WhenStartedBrick.class); whenBrickMap.put(R.string.brick_when_becomes_true,WhenConditionBrick.class); whenBrickMap.put(R.string.brick_when_cloned,WhenClonedBrick.class); whenBrickMap.put(R.string.brick_when_background,WhenBackgroundChangesBrick.class); whenBrickMap.put(R.string.brick_when_touched,WhenTouchDownBrick.class); whenBrickMap.put(R.string.brick_broadcast_receive,BroadcastReceiverBrick.class); whenBrickMap.put(R.string.brick_collision_receive,CollisionReceiverBrick.class); <START> whenBrickList.add(R.string.brick_when_started); <END> whenBrickList.add(R.string.brick_when_becomes_true); whenBrickList.add(R.string.brick_when_cloned); whenBrickList.add(R.string.brick_when_background); whenBrickList.add(R.string.brick_when_touched); whenBrickList.add(R.string.brick_broadcast_receive); whenBrickList.add(R.string.brick_collision_receive); baseActivityTestRule.launchActivity(null); }</code><technical_language>duplication, need for this list, iterate dictionary, whenBrickMap.keySet() returns a set of contained keys.</technical_language>

Target:
public void setUp() throws Exception { Script script = BrickTestUtils.createProjectAndGetStartScript("WhenBrickTest"); if (whenBrickClass.equals(CollisionReceiverBrick.class)) { script.addBrick(new CollisionReceiverBrick("TEST")); } else if (whenBrickClass.equals(BroadcastReceiverBrick.class)) { script.addBrick(new BroadcastReceiverBrick("TEST")); } else { script.addBrick((Brick) whenBrickClass.newInstance()); } script.addBrick(new PlaceAtBrick()); baseActivityTestRule.launchActivity(null); }
Source:
<code>public void testWithConnLevelUCFNoTableLevelUCF() throws Exception { long tableUpdateCacheFrequency = -1; long connUpdateCacheFrequency = 1000; String fullTableName = DEFAULT_SCHEMA_NAME + QueryConstants.NAME_SEPARATOR + generateUniqueName(); setUpTableAndConnections(fullTableName, tableUpdateCacheFrequency, connUpdateCacheFrequency); int numSelectExecutions = 2; int numExpectedGetTableCalls = 1; verifyExpectedGetTableCalls(fullTableName, numSelectExecutions, numExpectedGetTableCalls); <START> <END> Thread.sleep(connUpdateCacheFrequency); verifyExpectedGetTableCalls(fullTableName, numSelectExecutions, numExpectedGetTableCalls); }</code><technical_language>Ok sure, separate in case</technical_language>

Target:
public void testWithConnLevelUCFNoTableLevelUCF() throws Exception { final long connUpdateCacheFrequency = 1000; String fullTableName = DEFAULT_SCHEMA_NAME + QueryConstants.NAME_SEPARATOR + generateUniqueName(); setUpTableAndConnections(fullTableName, null, String.valueOf(connUpdateCacheFrequency)); int numExecutions = 2; int numExpectedGetTableCalls = 1; verifyExpectedGetTableCalls(fullTableName, numExecutions, numExpectedGetTableCalls); Thread.sleep(connUpdateCacheFrequency); verifyExpectedGetTableCalls(fullTableName, numExecutions, numExpectedGetTableCalls); }
Source:
<code>public Set<NamespaceAndUseCase> getAllNamespaceAndUseCaseTuples() { <START> return execute(dao -> dao.getAllNamespaceAndUseCaseTuples()); <END> }</code><technical_language>suggestion return execute(Queries::getAllNamespaceAndUseCaseTuples);</technical_language>

Target:
public Set<NamespaceAndUseCase> getAllNamespaceAndUseCaseTuples() { return execute(Queries::getAllNamespaceAndUseCaseTuples); }
Source:
<code>@Override public void onClose(Status status, Metadata trailers) { Throwable error = null; try (Scope scope = currentTraceContext.maybeScope(invocationContext)) { delegate().onClose(status, trailers); } catch (Throwable e) { <START> error = e; <END> throw e; } finally { GrpcClientResponse response = new GrpcClientResponse(request, status, trailers, error); finish(response, spanRef.getAndSet(null)); } }</code><technical_language>I this happen if is error in business logic client side processing closure, if request succeeded. this warrant marking span error</technical_language>

Target:
@Override public void onClose(Status status, Metadata trailers) { GrpcClientResponse response = new GrpcClientResponse(request, status, trailers, null); finish(response, spanRef.getAndSet(null)); try (Scope scope = currentTraceContext.maybeScope(invocationContext)) { delegate().onClose(status, trailers); } }
Source:
<code>public void onNext(final AllocatedEvaluator allocatedEvaluator) { final int evalCount = activeEvaluatorCount.getAndIncrement(); final String contextId = CONTEXT_ID_PREFIX + evalCount; final Configuration partialContextConf = ContextConfiguration.CONF .set(ContextConfiguration.IDENTIFIER, contextId) .build(); final Configuration contextConf = Configurations.merge( partialContextConf, emConf.getContextConfiguration(), aggregationManager.getContextConfiguration()); final Configuration serviceConf = Configurations.merge( emConf.getServiceConfiguration(contextId), aggregationManager.getServiceConfigurationWithoutNameResolver()); final Configuration traceConf = traceParameters.getConfiguration(); allocatedEvaluator.submitContextAndService(contextConf, Configurations.merge(serviceConf, traceConf)); <START> LOG.info((evalCount + 1) + " evaluators active!"); <END> }</code><technical_language>Please formatter</technical_language>

Target:
public void onNext(final AllocatedEvaluator allocatedEvaluator) { final int evalCount = activeEvaluatorCount.getAndIncrement(); final String contextId = CONTEXT_ID_PREFIX + evalCount; final Configuration partialContextConf = ContextConfiguration.CONF .set(ContextConfiguration.IDENTIFIER, contextId) .build(); final Configuration contextConf = Configurations.merge( partialContextConf, emConf.getContextConfiguration(), aggregationManager.getContextConfiguration()); final Configuration serviceConf = Configurations.merge( emConf.getServiceConfiguration(contextId), aggregationManager.getServiceConfigurationWithoutNameResolver()); final Configuration traceConf = traceParameters.getConfiguration(); allocatedEvaluator.submitContextAndService(contextConf, Configurations.merge(serviceConf, traceConf)); LOG.log(Level.INFO, "{0} evaluators active!", evalCount + 1); }
Source:
<code>private void recordWord(Word w) { <START> <END> if (RecordUtils.get().isRecording()) { return; } RecordUtils.get().startRecordWord(this, w.languageCode, w.serverID); recordingDialog.show(); handler.postDelayed(detectSound, DETECT_VOICE_INTERVAL); handler.postDelayed(new Runnable() { @Override public void run() { stopRecord(); } }, 3000); }</code><technical_language>Useless white space here</technical_language>

Target:
private void recordWord(Word w) { if (null != activeRecorder && activeRecorder.isRecording()) { activeRecorder.stop(); } File wsfile = WordSoundFileUtils.getFile(this, w.languageCode, w.serverID); activeRecorder = RecordUtils.get().createRecorder(wsfile); try { activeRecorder.start(); } catch (IllegalStateException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } recordingDialog.setCurrentRecordLength(0); recordingDialog.show(); handler.postDelayed(detectSound, DETECT_VOICE_INTERVAL); handler.postDelayed(countdownRecordTime, 1000); }
Source:
<code>private Map<String, Object> getAnnotationValues(Annotation annotation) { if ( Proxy.isProxyClass( annotation.getClass() ) ) { InvocationHandler invocationHandler = Proxy.getInvocationHandler( annotation ); if ( invocationHandler instanceof AnnotationProxy ) { return ( (AnnotationProxy) invocationHandler ).values; <START> } <END> } AnnotationParameters annotationParameters = run( GetAnnotationParameters.action( annotation ) ); return annotationParameters.getParameters(); }</code><technical_language>commit message is a bit mis-leading IMHO, proxies created ourselves. I thought access parameter map of actual sun.reflect.annotation.AnnotationInvocationHandler</technical_language>

Target:
private Map<String, Object> getAnnotationValues(Annotation annotation) { if ( Proxy.isProxyClass( annotation.getClass() ) && System.getSecurityManager() == null ) { InvocationHandler invocationHandler = Proxy.getInvocationHandler( annotation ); if ( invocationHandler instanceof AnnotationProxy ) { return ( (AnnotationProxy) invocationHandler ).values; } } AnnotationParameters annotationParameters = run( GetAnnotationParameters.action( annotation ) ); return annotationParameters.getParameters(); }
Source:
<code>public void createControls(Composite parent, TabbedPropertySheetPage tabbedPropertySheetPage) { if (tabbedPropertySheetPage instanceof ViewpointPropertySheetPage) super.createControls(parent, (ViewpointPropertySheetPage) tabbedPropertySheetPage); else super.createControls(parent, tabbedPropertySheetPage); composite = getWidgetFactory().createFlatFormComposite(parent); <START> FormData data; nameLabel = getWidgetFactory().createCLabel(composite, "Add option override"); data = new FormData(); data.left = new FormAttachment(5, 5); nameLabel.setLayoutData(data); Image addImage = ExtendedImageRegistry.INSTANCE.getImage(DiagramUIPlugin.getPlugin().getImage(LayoutOptionPropertiesUtils.ADD_OPTION_IMAGE_NAME)); addOverrideButton = getWidgetFactory().createButton(composite, "", SWT.PUSH); addOverrideButton.setImage(addImage); data = new FormData(); data.left = new FormAttachment(0, 0); data.top = new FormAttachment(nameLabel, 0, SWT.CENTER); data.right = new FormAttachment(4, 0); addOverrideButton.setLayoutData(data); addOverrideButton.addSelectionListener(createButtonListener()); <END> }</code><technical_language>machine, top of "+" button is visible this layout. Also, "Add option override" *in* button (in addition image) instead of of it</technical_language>

Target:
public void createControls(Composite parent, TabbedPropertySheetPage tabbedPropertySheetPage) { if (tabbedPropertySheetPage instanceof ViewpointPropertySheetPage) super.createControls(parent, (ViewpointPropertySheetPage) tabbedPropertySheetPage); else super.createControls(parent, tabbedPropertySheetPage); composite = getWidgetFactory().createFlatFormComposite(parent); FormData data; Image addImage = ExtendedImageRegistry.INSTANCE.getImage(DiagramUIPlugin.getPlugin().getImage(LayoutOptionPropertiesUtils.ADD_OPTION_IMAGE_NAME)); addOverrideButton = getWidgetFactory().createButton(composite, "", SWT.PUSH); addOverrideButton.setImage(addImage); addOverrideButton.setText(Messages.AddOptionOverridePropertySection_overrideButtonLabel); data = new FormData(); data.left = new FormAttachment(0, 0); data.right = new FormAttachment(9, 0); addOverrideButton.setLayoutData(data); addOverrideButton.addSelectionListener(createButtonListener()); }
Source:
<code>public ResponseEntity<?> getDistance(@PathVariable("eventTypeName") final String eventTypeName, @Valid @RequestBody final ValidListWrapper<CursorDistance> queries, final Client client) throws InternalNakadiException, NoSuchEventTypeException { checkReadScopes(eventTypeName, client); final EventType eventType = eventTypeRepository.findByName(eventTypeName); <START> authorizeStreamRead(authorizationService, client, eventType); <END> queries.getList().forEach(query -> { try { final NakadiCursor initialCursor = cursorConverter .convert(eventTypeName, query.getInitialCursor()); final NakadiCursor finalCursor = cursorConverter .convert(eventTypeName, query.getFinalCursor()); final Long distance = cursorOperationsService.calculateDistance(initialCursor, finalCursor); query.setDistance(distance); } catch (InternalNakadiException | ServiceUnavailableException e) { throw new MyNakadiRuntimeException1("problem calculating cursors distance", e); } catch (final NoSuchEventTypeException e) { throw new NotFoundException("event type not found", e); } catch (final InvalidCursorException e) { throw new CursorConversionException("problem converting cursors", e); } }); return status(OK).body(queries.getList()); }</code><technical_language>calls service layer</technical_language>

Target:
public ResponseEntity<?> getDistance(@PathVariable("eventTypeName") final String eventTypeName, @Valid @RequestBody final ValidListWrapper<CursorDistance> queries, final Client client) throws InternalNakadiException, NoSuchEventTypeException { checkReadScopes(eventTypeName, client); final EventType eventType = eventTypeRepository.findByName(eventTypeName); authorizationValidator.authorizeStreamRead(client, eventType); queries.getList().forEach(query -> { try { final NakadiCursor initialCursor = cursorConverter .convert(eventTypeName, query.getInitialCursor()); final NakadiCursor finalCursor = cursorConverter .convert(eventTypeName, query.getFinalCursor()); final Long distance = cursorOperationsService.calculateDistance(initialCursor, finalCursor); query.setDistance(distance); } catch (InternalNakadiException | ServiceUnavailableException e) { throw new MyNakadiRuntimeException1("problem calculating cursors distance", e); } catch (final NoSuchEventTypeException e) { throw new NotFoundException("event type not found", e); } catch (final InvalidCursorException e) { throw new CursorConversionException("problem converting cursors", e); } }); return status(OK).body(queries.getList()); }
Source:
<code>public void onException(SQLException e, OperationType operationType) { if (e instanceof SQLTransientConnectionException) { if (operationType == OperationType.Write) { <START> metrics.writeRate.mark(); <END> metrics.writeFailureCount.inc(); } else if (operationType == OperationType.Read) { metrics.readRate.mark(); metrics.readFailureCount.inc(); } else if (operationType == OperationType.Copy) { metrics.copyRate.mark(); metrics.copyFailureCount.inc(); } closeActiveConnection(); } }</code><technical_language>I thinking if move this caller method separate metrics for AccountService AccountStatsReport. Thus, a clear view QPS AccountService, Account Stats/ Quota Service</technical_language>

Target:
public void onException(SQLException e, OperationType operationType) { if (e instanceof SQLTransientConnectionException) { if (operationType == OperationType.Write) { metrics.writeFailureCount.inc(); } else if (operationType == OperationType.Read) { metrics.readFailureCount.inc(); } else if (operationType == OperationType.Copy) { metrics.copyFailureCount.inc(); } closeActiveConnection(); } }
Source:
<code>public void visitLiteral(Object constant) { if (constant instanceof Boolean) { append(constant.toString()); } else if (constant instanceof Number) { append(constant.toString()); } else if (constant instanceof String) { append("'"); append(escapeLiteral(constant.toString())); append("'"); <START> } else if (constant instanceof Enum) { <END> append(constant.getClass().getName()); append("."); append(((Enum<?>) constant).name()); } else { throw new IllegalArgumentException("Unsupported constant " + constant); } }</code><technical_language>For consistency instanceof Enum<?></technical_language>

Target:
public void visitLiteral(Object constant) { if (constant instanceof Boolean) { append(constant.toString()); } else if (constant instanceof Number) { append(constant.toString()); } else if (constant instanceof String) { append("'"); append(escapeLiteral(constant.toString())); append("'"); } else if (constant instanceof Enum<?>) { append(constant.getClass().getName()); append("."); append(((Enum<?>) constant).name()); } else { throw new IllegalArgumentException("Unsupported constant " + constant); } }