comment stringlengths 22 3.02k | method_body stringlengths 46 368k | target_code stringlengths 0 181 | method_body_after stringlengths 12 368k | context_before stringlengths 11 634k | context_after stringlengths 11 632k |
|---|---|---|---|---|---|
Do we already have positive tests for this? | public void setup() {
compileResult = BCompileUtil.compile("test-src/annotations/annot_attachments_negative.bal");
Assert.assertEquals(compileResult.getErrorCount(), 266);
} | Assert.assertEquals(compileResult.getErrorCount(), 266); | public void setup() {
compileResult = BCompileUtil.compile("test-src/annotations/annot_attachments_negative.bal");
Assert.assertEquals(compileResult.getErrorCount(), 266);
} | class AnnotationAttachmentNegativeTest {
private CompileResult compileResult;
@BeforeClass
@Test
public void testInvalidAttachmentOnType() {
int index = 0;
int line = 39;
validateError(compileResult, index++, "annotation 'v2' is not allowed on type", line, 1);
val... | class AnnotationAttachmentNegativeTest {
private CompileResult compileResult;
@BeforeClass
@Test
public void testInvalidAttachmentOnType() {
int index = 0;
int line = 39;
validateError(compileResult, index++, "annotation 'v2' is not allowed on type", line, 1);
val... |
I think this is no longer valid. | private ClassLoader getClassLoader() {
ClassLoader cl = Thread.currentThread().getContextClassLoader();
if (cl == null) {
cl = getClass().getClassLoader();
}
if (cl == null) {
cl = Object.class.getClassLoader();
}
... | private ClassLoader getClassLoader() {
ClassLoader cl = Thread.currentThread().getContextClassLoader();
if (cl == null) {
cl = getClass().getClassLoader();
}
if (cl == null) {
cl = Object.class.getClassLoader();
}
return cl;
} | class DevClasspathStaticHandler implements Handler<RoutingContext> {
private static final Logger LOG = Logger.getLogger(DevClasspathStaticHandler.class);
private static final Set<HttpMethod> ALLOWED_HTTP_METHODS = Set.of(HttpMethod.GET, HttpMethod.HEAD, HttpMethod.OPTIONS);
private static final int HTTP_ST... | class DevClasspathStaticHandler implements Handler<RoutingContext> {
private static final Logger LOG = Logger.getLogger(DevClasspathStaticHandler.class);
private static final int HTTP_STATUS_OK = 200;
private static final int HTTP_STATUS_NO_CONTENT = 204;
private static final String ALLOW_HEADER = "All... | |
Okay got it :) So we can remove the check for the os and have only the check for the file name | private static boolean isDirEmpty(final Path directory) throws IOException {
try (DirectoryStream<Path> dirStream = Files.newDirectoryStream(directory)) {
Iterator pathIterator = dirStream.iterator();
if (pathIterator.hasNext()) {
Path path = (Path) pathIte... | !pathIterator.hasNext(); | private static boolean isDirEmpty(final Path directory) throws IOException {
try (DirectoryStream<Path> dirStream = Files.newDirectoryStream(directory)) {
Iterator pathIterator = dirStream.iterator();
if (!pathIterator.hasNext()) {
return true;
}... | class InitCommand implements BLauncherCmd {
public static final String DEFAULT_VERSION = "0.0.1";
private static final String USER_DIR = "user.dir";
private static final PrintStream errStream = System.err;
private final Path homePath = RepoUtils.createAndGetHomeReposPath();
private boolean alreadyI... | class InitCommand implements BLauncherCmd {
public static final String DEFAULT_VERSION = "0.0.1";
private static final String USER_DIR = "user.dir";
private static final PrintStream errStream = System.err;
private final Path homePath = RepoUtils.createAndGetHomeReposPath();
private boolean alreadyI... |
If you need to support functions not in the form of xx(), but fun(A, B) in the future, how do you need to be compatible? | public Expr obtainExpr() {
if (SUPPORTED_DEFAULT_FNS.contains(expr)) {
String functionName = expr.replace("()", "");
FunctionCallExpr functionCallExpr = new FunctionCallExpr(new FunctionName(functionName), Lists.newArrayList());
Function fn = Expr.getBuiltinFunction(functionN... | String functionName = expr.replace("()", ""); | public Expr obtainExpr() {
if (SUPPORTED_DEFAULT_FNS.contains(expr)) {
String functionName = expr.replace("()", "");
FunctionCallExpr functionCallExpr = new FunctionCallExpr(new FunctionName(functionName), Lists.newArrayList());
Function fn = Expr.getBuiltinFunction(functionN... | class DefaultExpr {
public static final Set<String> SUPPORTED_DEFAULT_FNS = ImmutableSet.of("uuid()", "uuid_numeric()");
@SerializedName("expr")
private String expr;
public DefaultExpr(String expr) {
this.expr = expr;
}
public String getExpr() {
return expr;
}
public... | class DefaultExpr {
public static final Set<String> SUPPORTED_DEFAULT_FNS = ImmutableSet.of("uuid()", "uuid_numeric()");
@SerializedName("expr")
private String expr;
public DefaultExpr(String expr) {
this.expr = expr;
}
public String getExpr() {
return expr;
}
public... |
Why are we setting a default page size here? Shouldn't this be handled by the creator of this type? | public ContinuablePagedIterable(ContinuablePagedFlux<C, T, P> pagedFlux, int batchSize) {
super(pagedFlux);
this.pagedFlux = pagedFlux;
this.batchSize = batchSize;
this.defaultPageSize = 1;
this.continuationPredicate = null;
this.syncPageRetrieverProvider = null;
} | this.defaultPageSize = 1; | public ContinuablePagedIterable(ContinuablePagedFlux<C, T, P> pagedFlux, int batchSize) {
super(pagedFlux);
this.pagedFlux = pagedFlux;
this.batchSize = batchSize;
this.defaultPageSize = null;
this.continuationPredicate = null;
this.pageRetrieverSyncProvider = null;
} | class ContinuablePagedIterable<C, T, P extends ContinuablePage<C, T>> extends IterableStream<T> {
private static final ClientLogger LOGGER = new ClientLogger(ContinuablePagedIterable.class);
private final ContinuablePagedFlux<C, T, P> pagedFlux;
private final int batchSize;
private final Supplier<SyncPa... | class ContinuablePagedIterable<C, T, P extends ContinuablePage<C, T>> extends IterableStream<T> {
private static final ClientLogger LOGGER = new ClientLogger(ContinuablePagedIterable.class);
private final ContinuablePagedFlux<C, T, P> pagedFlux;
private final int batchSize;
private final Supplier<PageRe... |
@pubudu538 ATM T1 values are all capital. eg: `ARRAY`. Shall we make it like `Array`? | private String getTypeErrorMessage(Type found) {
Map<String, String> message = this.schema.message();
String typeCustomMessage = message.get(SchemaDeserializer.TYPE);
if (typeCustomMessage == null) {
return String.format("key '%s' expects %s . found %s", this.key, schema.type(), foun... | return String.format("key '%s' expects %s . found %s", this.key, schema.type(), found); | private String getTypeErrorMessage(Type found) {
Map<String, String> message = this.schema.message();
String typeCustomMessage = message.get(SchemaDeserializer.TYPE);
if (typeCustomMessage == null) {
return String.format("incompatible type for key '%s': expected '%s', found '%s'", th... | class SchemaValidator extends TomlNodeVisitor {
private static final String PROPERTY_HOLDER = "${property}";
private AbstractSchema schema;
private String key;
public SchemaValidator(Schema schema) {
this.schema = schema;
}
@Override
public void visit(TomlTableNode tomlTableNode)... | class SchemaValidator extends TomlNodeVisitor {
private static final String PROPERTY_HOLDER = "${property}";
private AbstractSchema schema;
private String key;
private String schemaTitle;
public SchemaValidator(Schema schema) {
this.schema = schema;
this.schemaTitle = schema.title... |
`totalCount` has been removed from accumulator in the latest commit, and will be calculated in `getValue()` once needed. | public Double[] getValue() {
List<Pair<Double, Integer>> sortedPercentages = new ArrayList<>();
for (int index = 0; index < percentages.length; index++) {
sortedPercentages.add(new Pair<>(percentages[index] * (totalCount - 1) + 1, index));
}
... | public Double[] getValue() {
long totalCount = 0L;
List<Map.Entry<Double, Long>> sortedList = new ArrayList<>();
try {
for (Map.Entry<Double, Long> entry : valueCount.entries()) {
sortedList.add(... | class PercentileAccumulator {
public double[] percentages;
public long totalCount;
public MapView<Double, Long> valueCount;
@Override
public boolean equals(Object o) {
if (this == o) {
return true;
}
if (o == null || getClass(... | class PercentileAccumulator {
public double[] percentages;
public MapView<Double, Long> valueCount;
@Override
public boolean equals(Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
... | |
Imo it just shouldnt print anythiNg unless debug. Why would we want those behind firewalls to get annoying message on every build? | public void close() {
try {
CompletableFuture.allOf(postFutures.toArray(new CompletableFuture[0])).get(
PropertyUtils.getProperty("quarkus.analytics.timeout", DEFAULT_TIMEOUT),
TimeUnit.MILLISECONDS);
if (log.isDebugEnabled() && !postF... | log.info("[Quarkus build analytics] Failed to send build analytics to Segment. " + | public void close() {
try {
CompletableFuture.allOf(postFutures.toArray(new CompletableFuture[0])).get(
PropertyUtils.getProperty("quarkus.analytics.timeout", DEFAULT_TIMEOUT),
TimeUnit.MILLISECONDS);
if (log.isDebugEnabled() && !postF... | class AnalyticsService implements AutoCloseable {
private final Queue<CompletableFuture<HttpResponse<String>>> postFutures;
final private RestClient restClient;
final private ConfigService config;
final private AnonymousUserId userId;
final private MessageWriter log;
final FileLocations fileLoc... | class AnalyticsService implements AutoCloseable {
private final Queue<CompletableFuture<HttpResponse<String>>> postFutures;
final private RestClient restClient;
final private ConfigService config;
final private AnonymousUserId userId;
final private MessageWriter log;
final FileLocations fileLoc... |
Should we also add this change to the changelog? | "Mono<PiiEntityCollection> recognizePiiEntities(String document, String language) {\n try {\n(...TRUNCATED) | throw logger.logExceptionAsError(toTextAnalyticsException(entitiesResult.getError())); | "Mono<PiiEntityCollection> recognizePiiEntities(String document, String language) {\n try {\n(...TRUNCATED) | "class RecognizePiiEntityAsyncClient {\n private final ClientLogger logger = new ClientLogger(Rec(...TRUNCATED) | "class RecognizePiiEntityAsyncClient {\n private final ClientLogger logger = new ClientLogger(Rec(...TRUNCATED) |
Let's open a separate issue for that, it's a bigger piece of work | "public String getId() {\n String id = this.title.toLowerCase().replaceAll(SPACE, DASH);\n (...TRUNCATED) | id = URLEncoder.encode(id, StandardCharsets.UTF_8.toString()); | "public String getId() {\n String id = this.title.toLowerCase().replaceAll(SPACE, DASH);\n (...TRUNCATED) | "class Page {\n private final String icon; \n private final String title; \n private final (...TRUNCATED) | "class Page {\n private final String icon; \n private final String title; \n private final (...TRUNCATED) |
End of preview. Expand in Data Studio
README.md exists but content is empty.
- Downloads last month
- 3