id int32 0 165k | repo stringlengths 7 58 | path stringlengths 12 218 | func_name stringlengths 3 140 | original_string stringlengths 73 34.1k | language stringclasses 1
value | code stringlengths 73 34.1k | code_tokens list | docstring stringlengths 3 16k | docstring_tokens list | sha stringlengths 40 40 | url stringlengths 105 339 |
|---|---|---|---|---|---|---|---|---|---|---|---|
130,200 | OpenFeign/feign | core/src/main/java/feign/RequestTemplate.java | RequestTemplate.bodyTemplate | @Deprecated
public RequestTemplate bodyTemplate(String bodyTemplate) {
this.body(Request.Body.bodyTemplate(bodyTemplate, Util.UTF_8));
return this;
} | java | @Deprecated
public RequestTemplate bodyTemplate(String bodyTemplate) {
this.body(Request.Body.bodyTemplate(bodyTemplate, Util.UTF_8));
return this;
} | [
"@",
"Deprecated",
"public",
"RequestTemplate",
"bodyTemplate",
"(",
"String",
"bodyTemplate",
")",
"{",
"this",
".",
"body",
"(",
"Request",
".",
"Body",
".",
"bodyTemplate",
"(",
"bodyTemplate",
",",
"Util",
".",
"UTF_8",
")",
")",
";",
"return",
"this",
... | Specify the Body Template to use. Can contain literals and expressions.
@param bodyTemplate to use.
@return a RequestTemplate for chaining.
@deprecated replaced by {@link RequestTemplate#body(feign.Request.Body)} | [
"Specify",
"the",
"Body",
"Template",
"to",
"use",
".",
"Can",
"contain",
"literals",
"and",
"expressions",
"."
] | 318fb0e955b8cfcf64f70d6aeea0ba5795f8a7eb | https://github.com/OpenFeign/feign/blob/318fb0e955b8cfcf64f70d6aeea0ba5795f8a7eb/core/src/main/java/feign/RequestTemplate.java#L807-L811 |
130,201 | OpenFeign/feign | core/src/main/java/feign/RequestTemplate.java | RequestTemplate.getRequestVariables | public Collection<String> getRequestVariables() {
final Collection<String> variables = new LinkedHashSet<>(this.uriTemplate.getVariables());
this.queries.values().forEach(queryTemplate -> variables.addAll(queryTemplate.getVariables()));
this.headers.values()
.forEach(headerTemplate -> variables.addA... | java | public Collection<String> getRequestVariables() {
final Collection<String> variables = new LinkedHashSet<>(this.uriTemplate.getVariables());
this.queries.values().forEach(queryTemplate -> variables.addAll(queryTemplate.getVariables()));
this.headers.values()
.forEach(headerTemplate -> variables.addA... | [
"public",
"Collection",
"<",
"String",
">",
"getRequestVariables",
"(",
")",
"{",
"final",
"Collection",
"<",
"String",
">",
"variables",
"=",
"new",
"LinkedHashSet",
"<>",
"(",
"this",
".",
"uriTemplate",
".",
"getVariables",
"(",
")",
")",
";",
"this",
"... | Retrieve all uri, header, and query template variables.
@return a List of all the variable names. | [
"Retrieve",
"all",
"uri",
"header",
"and",
"query",
"template",
"variables",
"."
] | 318fb0e955b8cfcf64f70d6aeea0ba5795f8a7eb | https://github.com/OpenFeign/feign/blob/318fb0e955b8cfcf64f70d6aeea0ba5795f8a7eb/core/src/main/java/feign/RequestTemplate.java#L842-L848 |
130,202 | OpenFeign/feign | core/src/main/java/feign/RequestTemplate.java | RequestTemplate.queryLine | public String queryLine() {
StringBuilder queryString = new StringBuilder();
if (!this.queries.isEmpty()) {
Iterator<QueryTemplate> iterator = this.queries.values().iterator();
while (iterator.hasNext()) {
QueryTemplate queryTemplate = iterator.next();
String query = queryTemplate.t... | java | public String queryLine() {
StringBuilder queryString = new StringBuilder();
if (!this.queries.isEmpty()) {
Iterator<QueryTemplate> iterator = this.queries.values().iterator();
while (iterator.hasNext()) {
QueryTemplate queryTemplate = iterator.next();
String query = queryTemplate.t... | [
"public",
"String",
"queryLine",
"(",
")",
"{",
"StringBuilder",
"queryString",
"=",
"new",
"StringBuilder",
"(",
")",
";",
"if",
"(",
"!",
"this",
".",
"queries",
".",
"isEmpty",
"(",
")",
")",
"{",
"Iterator",
"<",
"QueryTemplate",
">",
"iterator",
"="... | The Query String for the template. Expressions are not resolved.
@return the Query String. | [
"The",
"Query",
"String",
"for",
"the",
"template",
".",
"Expressions",
"are",
"not",
"resolved",
"."
] | 318fb0e955b8cfcf64f70d6aeea0ba5795f8a7eb | https://github.com/OpenFeign/feign/blob/318fb0e955b8cfcf64f70d6aeea0ba5795f8a7eb/core/src/main/java/feign/RequestTemplate.java#L865-L892 |
130,203 | OpenFeign/feign | core/src/main/java/feign/template/QueryTemplate.java | QueryTemplate.append | public static QueryTemplate append(QueryTemplate queryTemplate,
Iterable<String> values,
CollectionFormat collectionFormat) {
List<String> queryValues = new ArrayList<>(queryTemplate.getValues());
queryValues.addAll(StreamSupport.stream(v... | java | public static QueryTemplate append(QueryTemplate queryTemplate,
Iterable<String> values,
CollectionFormat collectionFormat) {
List<String> queryValues = new ArrayList<>(queryTemplate.getValues());
queryValues.addAll(StreamSupport.stream(v... | [
"public",
"static",
"QueryTemplate",
"append",
"(",
"QueryTemplate",
"queryTemplate",
",",
"Iterable",
"<",
"String",
">",
"values",
",",
"CollectionFormat",
"collectionFormat",
")",
"{",
"List",
"<",
"String",
">",
"queryValues",
"=",
"new",
"ArrayList",
"<>",
... | Append a value to the Query Template.
@param queryTemplate to append to.
@param values to append.
@return a new QueryTemplate with value appended. | [
"Append",
"a",
"value",
"to",
"the",
"Query",
"Template",
"."
] | 318fb0e955b8cfcf64f70d6aeea0ba5795f8a7eb | https://github.com/OpenFeign/feign/blob/318fb0e955b8cfcf64f70d6aeea0ba5795f8a7eb/core/src/main/java/feign/template/QueryTemplate.java#L97-L106 |
130,204 | OpenFeign/feign | core/src/main/java/feign/template/QueryTemplate.java | QueryTemplate.expand | @Override
public String expand(Map<String, ?> variables) {
String name = this.name.expand(variables);
return this.queryString(name, super.expand(variables));
} | java | @Override
public String expand(Map<String, ?> variables) {
String name = this.name.expand(variables);
return this.queryString(name, super.expand(variables));
} | [
"@",
"Override",
"public",
"String",
"expand",
"(",
"Map",
"<",
"String",
",",
"?",
">",
"variables",
")",
"{",
"String",
"name",
"=",
"this",
".",
"name",
".",
"expand",
"(",
"variables",
")",
";",
"return",
"this",
".",
"queryString",
"(",
"name",
... | Expand this template. Unresolved variables are removed. If all values remain unresolved, the
result is an empty string.
@param variables containing the values for expansion.
@return the expanded template. | [
"Expand",
"this",
"template",
".",
"Unresolved",
"variables",
"are",
"removed",
".",
"If",
"all",
"values",
"remain",
"unresolved",
"the",
"result",
"is",
"an",
"empty",
"string",
"."
] | 318fb0e955b8cfcf64f70d6aeea0ba5795f8a7eb | https://github.com/OpenFeign/feign/blob/318fb0e955b8cfcf64f70d6aeea0ba5795f8a7eb/core/src/main/java/feign/template/QueryTemplate.java#L156-L160 |
130,205 | OpenFeign/feign | jaxb/src/main/java/feign/jaxb/JAXBContextFactory.java | JAXBContextFactory.preloadContextCache | private void preloadContextCache(List<Class<?>> classes) throws JAXBException {
if (classes != null && !classes.isEmpty()) {
for (Class<?> clazz : classes) {
getContext(clazz);
}
}
} | java | private void preloadContextCache(List<Class<?>> classes) throws JAXBException {
if (classes != null && !classes.isEmpty()) {
for (Class<?> clazz : classes) {
getContext(clazz);
}
}
} | [
"private",
"void",
"preloadContextCache",
"(",
"List",
"<",
"Class",
"<",
"?",
">",
">",
"classes",
")",
"throws",
"JAXBException",
"{",
"if",
"(",
"classes",
"!=",
"null",
"&&",
"!",
"classes",
".",
"isEmpty",
"(",
")",
")",
"{",
"for",
"(",
"Class",
... | Will preload factory's cache with JAXBContext for provided classes
@param classes
@throws JAXBException | [
"Will",
"preload",
"factory",
"s",
"cache",
"with",
"JAXBContext",
"for",
"provided",
"classes"
] | 318fb0e955b8cfcf64f70d6aeea0ba5795f8a7eb | https://github.com/OpenFeign/feign/blob/318fb0e955b8cfcf64f70d6aeea0ba5795f8a7eb/jaxb/src/main/java/feign/jaxb/JAXBContextFactory.java#L79-L85 |
130,206 | OpenFeign/feign | core/src/main/java/feign/Util.java | Util.valuesOrEmpty | public static <T> Collection<T> valuesOrEmpty(Map<String, Collection<T>> map, String key) {
return map.containsKey(key) && map.get(key) != null ? map.get(key) : Collections.<T>emptyList();
} | java | public static <T> Collection<T> valuesOrEmpty(Map<String, Collection<T>> map, String key) {
return map.containsKey(key) && map.get(key) != null ? map.get(key) : Collections.<T>emptyList();
} | [
"public",
"static",
"<",
"T",
">",
"Collection",
"<",
"T",
">",
"valuesOrEmpty",
"(",
"Map",
"<",
"String",
",",
"Collection",
"<",
"T",
">",
">",
"map",
",",
"String",
"key",
")",
"{",
"return",
"map",
".",
"containsKey",
"(",
"key",
")",
"&&",
"m... | Returns an unmodifiable collection which may be empty, but is never null. | [
"Returns",
"an",
"unmodifiable",
"collection",
"which",
"may",
"be",
"empty",
"but",
"is",
"never",
"null",
"."
] | 318fb0e955b8cfcf64f70d6aeea0ba5795f8a7eb | https://github.com/OpenFeign/feign/blob/318fb0e955b8cfcf64f70d6aeea0ba5795f8a7eb/core/src/main/java/feign/Util.java#L193-L195 |
130,207 | OpenFeign/feign | core/src/main/java/feign/Util.java | Util.emptyValueOf | public static Object emptyValueOf(Type type) {
return EMPTIES.getOrDefault(Types.getRawType(type), () -> null).get();
} | java | public static Object emptyValueOf(Type type) {
return EMPTIES.getOrDefault(Types.getRawType(type), () -> null).get();
} | [
"public",
"static",
"Object",
"emptyValueOf",
"(",
"Type",
"type",
")",
"{",
"return",
"EMPTIES",
".",
"getOrDefault",
"(",
"Types",
".",
"getRawType",
"(",
"type",
")",
",",
"(",
")",
"->",
"null",
")",
".",
"get",
"(",
")",
";",
"}"
] | This returns well known empty values for well-known java types. This returns null for types not
in the following list.
<ul>
<li>{@code [Bb]oolean}</li>
<li>{@code byte[]}</li>
<li>{@code Collection}</li>
<li>{@code Iterator}</li>
<li>{@code List}</li>
<li>{@code Map}</li>
<li>{@code Set}</li>
</ul>
<p/>
When {@link F... | [
"This",
"returns",
"well",
"known",
"empty",
"values",
"for",
"well",
"-",
"known",
"java",
"types",
".",
"This",
"returns",
"null",
"for",
"types",
"not",
"in",
"the",
"following",
"list",
"."
] | 318fb0e955b8cfcf64f70d6aeea0ba5795f8a7eb | https://github.com/OpenFeign/feign/blob/318fb0e955b8cfcf64f70d6aeea0ba5795f8a7eb/core/src/main/java/feign/Util.java#L255-L257 |
130,208 | OpenFeign/feign | benchmark/src/main/java/feign/benchmark/WhatShouldWeCacheBenchmarks.java | WhatShouldWeCacheBenchmarks.buildAndQuery_fake | @Benchmark
public Response buildAndQuery_fake() {
return Feign.builder().client(fakeClient)
.target(FeignTestInterface.class, "http://localhost").query();
} | java | @Benchmark
public Response buildAndQuery_fake() {
return Feign.builder().client(fakeClient)
.target(FeignTestInterface.class, "http://localhost").query();
} | [
"@",
"Benchmark",
"public",
"Response",
"buildAndQuery_fake",
"(",
")",
"{",
"return",
"Feign",
".",
"builder",
"(",
")",
".",
"client",
"(",
"fakeClient",
")",
".",
"target",
"(",
"FeignTestInterface",
".",
"class",
",",
"\"http://localhost\"",
")",
".",
"q... | How fast is creating a feign instance for each http request, without considering network? | [
"How",
"fast",
"is",
"creating",
"a",
"feign",
"instance",
"for",
"each",
"http",
"request",
"without",
"considering",
"network?"
] | 318fb0e955b8cfcf64f70d6aeea0ba5795f8a7eb | https://github.com/OpenFeign/feign/blob/318fb0e955b8cfcf64f70d6aeea0ba5795f8a7eb/benchmark/src/main/java/feign/benchmark/WhatShouldWeCacheBenchmarks.java#L93-L97 |
130,209 | OpenFeign/feign | benchmark/src/main/java/feign/benchmark/WhatShouldWeCacheBenchmarks.java | WhatShouldWeCacheBenchmarks.buildAndQuery_fake_cachedContract | @Benchmark
public Response buildAndQuery_fake_cachedContract() {
return Feign.builder().contract(cachedContact).client(fakeClient)
.target(FeignTestInterface.class, "http://localhost").query();
} | java | @Benchmark
public Response buildAndQuery_fake_cachedContract() {
return Feign.builder().contract(cachedContact).client(fakeClient)
.target(FeignTestInterface.class, "http://localhost").query();
} | [
"@",
"Benchmark",
"public",
"Response",
"buildAndQuery_fake_cachedContract",
"(",
")",
"{",
"return",
"Feign",
".",
"builder",
"(",
")",
".",
"contract",
"(",
"cachedContact",
")",
".",
"client",
"(",
"fakeClient",
")",
".",
"target",
"(",
"FeignTestInterface",
... | How fast is creating a feign instance for each http request, without considering network, and
without re-parsing the annotated http api? | [
"How",
"fast",
"is",
"creating",
"a",
"feign",
"instance",
"for",
"each",
"http",
"request",
"without",
"considering",
"network",
"and",
"without",
"re",
"-",
"parsing",
"the",
"annotated",
"http",
"api?"
] | 318fb0e955b8cfcf64f70d6aeea0ba5795f8a7eb | https://github.com/OpenFeign/feign/blob/318fb0e955b8cfcf64f70d6aeea0ba5795f8a7eb/benchmark/src/main/java/feign/benchmark/WhatShouldWeCacheBenchmarks.java#L103-L107 |
130,210 | OpenFeign/feign | benchmark/src/main/java/feign/benchmark/RealRequestBenchmarks.java | RealRequestBenchmarks.query_baseCaseUsingOkHttp | @Benchmark
public okhttp3.Response query_baseCaseUsingOkHttp() throws IOException {
okhttp3.Response result = client.newCall(queryRequest).execute();
result.body().close();
return result;
} | java | @Benchmark
public okhttp3.Response query_baseCaseUsingOkHttp() throws IOException {
okhttp3.Response result = client.newCall(queryRequest).execute();
result.body().close();
return result;
} | [
"@",
"Benchmark",
"public",
"okhttp3",
".",
"Response",
"query_baseCaseUsingOkHttp",
"(",
")",
"throws",
"IOException",
"{",
"okhttp3",
".",
"Response",
"result",
"=",
"client",
".",
"newCall",
"(",
"queryRequest",
")",
".",
"execute",
"(",
")",
";",
"result",... | How fast can we execute get commands synchronously? | [
"How",
"fast",
"can",
"we",
"execute",
"get",
"commands",
"synchronously?"
] | 318fb0e955b8cfcf64f70d6aeea0ba5795f8a7eb | https://github.com/OpenFeign/feign/blob/318fb0e955b8cfcf64f70d6aeea0ba5795f8a7eb/benchmark/src/main/java/feign/benchmark/RealRequestBenchmarks.java#L87-L92 |
130,211 | OpenFeign/feign | hystrix/src/main/java/feign/hystrix/HystrixInvocationHandler.java | HystrixInvocationHandler.toFallbackMethod | static Map<Method, Method> toFallbackMethod(Map<Method, MethodHandler> dispatch) {
Map<Method, Method> result = new LinkedHashMap<Method, Method>();
for (Method method : dispatch.keySet()) {
method.setAccessible(true);
result.put(method, method);
}
return result;
} | java | static Map<Method, Method> toFallbackMethod(Map<Method, MethodHandler> dispatch) {
Map<Method, Method> result = new LinkedHashMap<Method, Method>();
for (Method method : dispatch.keySet()) {
method.setAccessible(true);
result.put(method, method);
}
return result;
} | [
"static",
"Map",
"<",
"Method",
",",
"Method",
">",
"toFallbackMethod",
"(",
"Map",
"<",
"Method",
",",
"MethodHandler",
">",
"dispatch",
")",
"{",
"Map",
"<",
"Method",
",",
"Method",
">",
"result",
"=",
"new",
"LinkedHashMap",
"<",
"Method",
",",
"Meth... | If the method param of InvocationHandler.invoke is not accessible, i.e in a package-private
interface, the fallback call in hystrix command will fail cause of access restrictions. But
methods in dispatch are copied methods. So setting access to dispatch method doesn't take
effect to the method in InvocationHandler.invo... | [
"If",
"the",
"method",
"param",
"of",
"InvocationHandler",
".",
"invoke",
"is",
"not",
"accessible",
"i",
".",
"e",
"in",
"a",
"package",
"-",
"private",
"interface",
"the",
"fallback",
"call",
"in",
"hystrix",
"command",
"will",
"fail",
"cause",
"of",
"ac... | 318fb0e955b8cfcf64f70d6aeea0ba5795f8a7eb | https://github.com/OpenFeign/feign/blob/318fb0e955b8cfcf64f70d6aeea0ba5795f8a7eb/hystrix/src/main/java/feign/hystrix/HystrixInvocationHandler.java#L62-L69 |
130,212 | OpenFeign/feign | hystrix/src/main/java/feign/hystrix/HystrixInvocationHandler.java | HystrixInvocationHandler.toSetters | static Map<Method, Setter> toSetters(SetterFactory setterFactory,
Target<?> target,
Set<Method> methods) {
Map<Method, Setter> result = new LinkedHashMap<Method, Setter>();
for (Method method : methods) {
method.setAccessible(tr... | java | static Map<Method, Setter> toSetters(SetterFactory setterFactory,
Target<?> target,
Set<Method> methods) {
Map<Method, Setter> result = new LinkedHashMap<Method, Setter>();
for (Method method : methods) {
method.setAccessible(tr... | [
"static",
"Map",
"<",
"Method",
",",
"Setter",
">",
"toSetters",
"(",
"SetterFactory",
"setterFactory",
",",
"Target",
"<",
"?",
">",
"target",
",",
"Set",
"<",
"Method",
">",
"methods",
")",
"{",
"Map",
"<",
"Method",
",",
"Setter",
">",
"result",
"="... | Process all methods in the target so that appropriate setters are created. | [
"Process",
"all",
"methods",
"in",
"the",
"target",
"so",
"that",
"appropriate",
"setters",
"are",
"created",
"."
] | 318fb0e955b8cfcf64f70d6aeea0ba5795f8a7eb | https://github.com/OpenFeign/feign/blob/318fb0e955b8cfcf64f70d6aeea0ba5795f8a7eb/hystrix/src/main/java/feign/hystrix/HystrixInvocationHandler.java#L74-L83 |
130,213 | spring-cloud/spring-cloud-netflix | spring-cloud-netflix-turbine/src/main/java/org/springframework/cloud/netflix/turbine/SpringAggregatorFactory.java | SpringAggregatorFactory.shutdownClusterMonitors | @Override
public void shutdownClusterMonitors() {
for (String clusterName : clustersProvider.getClusterNames()) {
ClusterMonitor<AggDataFromCluster> clusterMonitor = (ClusterMonitor<AggDataFromCluster>) AggregateClusterMonitor
.findOrRegisterAggregateMonitor(clusterName);
clusterMonitor.stopMonitor();
... | java | @Override
public void shutdownClusterMonitors() {
for (String clusterName : clustersProvider.getClusterNames()) {
ClusterMonitor<AggDataFromCluster> clusterMonitor = (ClusterMonitor<AggDataFromCluster>) AggregateClusterMonitor
.findOrRegisterAggregateMonitor(clusterName);
clusterMonitor.stopMonitor();
... | [
"@",
"Override",
"public",
"void",
"shutdownClusterMonitors",
"(",
")",
"{",
"for",
"(",
"String",
"clusterName",
":",
"clustersProvider",
".",
"getClusterNames",
"(",
")",
")",
"{",
"ClusterMonitor",
"<",
"AggDataFromCluster",
">",
"clusterMonitor",
"=",
"(",
"... | shutdown all configured cluster monitors. | [
"shutdown",
"all",
"configured",
"cluster",
"monitors",
"."
] | 03b1e326ce5971c41239890dc71cae616366cff8 | https://github.com/spring-cloud/spring-cloud-netflix/blob/03b1e326ce5971c41239890dc71cae616366cff8/spring-cloud-netflix-turbine/src/main/java/org/springframework/cloud/netflix/turbine/SpringAggregatorFactory.java#L94-L102 |
130,214 | spring-cloud/spring-cloud-netflix | spring-cloud-netflix-ribbon/src/main/java/org/springframework/cloud/netflix/ribbon/SpringClientFactory.java | SpringClientFactory.getClient | public <C extends IClient<?, ?>> C getClient(String name, Class<C> clientClass) {
return getInstance(name, clientClass);
} | java | public <C extends IClient<?, ?>> C getClient(String name, Class<C> clientClass) {
return getInstance(name, clientClass);
} | [
"public",
"<",
"C",
"extends",
"IClient",
"<",
"?",
",",
"?",
">",
">",
"C",
"getClient",
"(",
"String",
"name",
",",
"Class",
"<",
"C",
">",
"clientClass",
")",
"{",
"return",
"getInstance",
"(",
"name",
",",
"clientClass",
")",
";",
"}"
] | Get the rest client associated with the name.
@param name name to search by
@param clientClass the class of the client bean
@param <C> {@link IClient} subtype
@return {@link IClient} instance
@throws RuntimeException if any error occurs | [
"Get",
"the",
"rest",
"client",
"associated",
"with",
"the",
"name",
"."
] | 03b1e326ce5971c41239890dc71cae616366cff8 | https://github.com/spring-cloud/spring-cloud-netflix/blob/03b1e326ce5971c41239890dc71cae616366cff8/spring-cloud-netflix-ribbon/src/main/java/org/springframework/cloud/netflix/ribbon/SpringClientFactory.java#L54-L56 |
130,215 | spring-cloud/spring-cloud-netflix | spring-cloud-netflix-eureka-server/src/main/java/org/springframework/cloud/netflix/eureka/server/EurekaServerBootstrap.java | EurekaServerBootstrap.destroyEurekaServerContext | protected void destroyEurekaServerContext() throws Exception {
EurekaMonitors.shutdown();
if (this.awsBinder != null) {
this.awsBinder.shutdown();
}
if (this.serverContext != null) {
this.serverContext.shutdown();
}
} | java | protected void destroyEurekaServerContext() throws Exception {
EurekaMonitors.shutdown();
if (this.awsBinder != null) {
this.awsBinder.shutdown();
}
if (this.serverContext != null) {
this.serverContext.shutdown();
}
} | [
"protected",
"void",
"destroyEurekaServerContext",
"(",
")",
"throws",
"Exception",
"{",
"EurekaMonitors",
".",
"shutdown",
"(",
")",
";",
"if",
"(",
"this",
".",
"awsBinder",
"!=",
"null",
")",
"{",
"this",
".",
"awsBinder",
".",
"shutdown",
"(",
")",
";"... | Server context shutdown hook. Override for custom logic
@throws Exception - calling {@link AwsBinder#shutdown()} or
{@link EurekaServerContext#shutdown()} may result in an exception | [
"Server",
"context",
"shutdown",
"hook",
".",
"Override",
"for",
"custom",
"logic"
] | 03b1e326ce5971c41239890dc71cae616366cff8 | https://github.com/spring-cloud/spring-cloud-netflix/blob/03b1e326ce5971c41239890dc71cae616366cff8/spring-cloud-netflix-eureka-server/src/main/java/org/springframework/cloud/netflix/eureka/server/EurekaServerBootstrap.java#L168-L176 |
130,216 | spring-cloud/spring-cloud-netflix | spring-cloud-netflix-turbine/src/main/java/org/springframework/cloud/netflix/turbine/CommonsInstanceDiscovery.java | CommonsInstanceDiscovery.getInstanceList | @Override
public Collection<Instance> getInstanceList() throws Exception {
List<Instance> instances = new ArrayList<>();
List<String> appNames = getApplications();
if (appNames == null || appNames.size() == 0) {
log.info("No apps configured, returning an empty instance list");
return instances;
}
log.i... | java | @Override
public Collection<Instance> getInstanceList() throws Exception {
List<Instance> instances = new ArrayList<>();
List<String> appNames = getApplications();
if (appNames == null || appNames.size() == 0) {
log.info("No apps configured, returning an empty instance list");
return instances;
}
log.i... | [
"@",
"Override",
"public",
"Collection",
"<",
"Instance",
">",
"getInstanceList",
"(",
")",
"throws",
"Exception",
"{",
"List",
"<",
"Instance",
">",
"instances",
"=",
"new",
"ArrayList",
"<>",
"(",
")",
";",
"List",
"<",
"String",
">",
"appNames",
"=",
... | Method that queries DiscoveryClient for a list of configured application names.
@return Collection of instances | [
"Method",
"that",
"queries",
"DiscoveryClient",
"for",
"a",
"list",
"of",
"configured",
"application",
"names",
"."
] | 03b1e326ce5971c41239890dc71cae616366cff8 | https://github.com/spring-cloud/spring-cloud-netflix/blob/03b1e326ce5971c41239890dc71cae616366cff8/spring-cloud-netflix-turbine/src/main/java/org/springframework/cloud/netflix/turbine/CommonsInstanceDiscovery.java#L102-L128 |
130,217 | spring-cloud/spring-cloud-netflix | spring-cloud-netflix-turbine/src/main/java/org/springframework/cloud/netflix/turbine/CommonsInstanceDiscovery.java | CommonsInstanceDiscovery.getInstancesForApp | protected List<Instance> getInstancesForApp(String serviceId) throws Exception {
List<Instance> instances = new ArrayList<>();
log.info("Fetching instances for app: " + serviceId);
List<ServiceInstance> serviceInstances = discoveryClient.getInstances(serviceId);
if (serviceInstances == null || serviceInstances.... | java | protected List<Instance> getInstancesForApp(String serviceId) throws Exception {
List<Instance> instances = new ArrayList<>();
log.info("Fetching instances for app: " + serviceId);
List<ServiceInstance> serviceInstances = discoveryClient.getInstances(serviceId);
if (serviceInstances == null || serviceInstances.... | [
"protected",
"List",
"<",
"Instance",
">",
"getInstancesForApp",
"(",
"String",
"serviceId",
")",
"throws",
"Exception",
"{",
"List",
"<",
"Instance",
">",
"instances",
"=",
"new",
"ArrayList",
"<>",
"(",
")",
";",
"log",
".",
"info",
"(",
"\"Fetching instan... | helper that fetches the Instances for each application from DiscoveryClient.
@param serviceId Id of the service whose instances should be returned
@return List of instances
@throws Exception - retrieving and marshalling service instances may result in an
Exception | [
"helper",
"that",
"fetches",
"the",
"Instances",
"for",
"each",
"application",
"from",
"DiscoveryClient",
"."
] | 03b1e326ce5971c41239890dc71cae616366cff8 | https://github.com/spring-cloud/spring-cloud-netflix/blob/03b1e326ce5971c41239890dc71cae616366cff8/spring-cloud-netflix-turbine/src/main/java/org/springframework/cloud/netflix/turbine/CommonsInstanceDiscovery.java#L141-L163 |
130,218 | spring-cloud/spring-cloud-netflix | spring-cloud-netflix-turbine/src/main/java/org/springframework/cloud/netflix/turbine/CommonsInstanceDiscovery.java | CommonsInstanceDiscovery.marshall | Instance marshall(ServiceInstance serviceInstance) {
String hostname = serviceInstance.getHost();
String managementPort = serviceInstance.getMetadata().get("management.port");
String port = managementPort == null ? String.valueOf(serviceInstance.getPort())
: managementPort;
String cluster = getClusterName(s... | java | Instance marshall(ServiceInstance serviceInstance) {
String hostname = serviceInstance.getHost();
String managementPort = serviceInstance.getMetadata().get("management.port");
String port = managementPort == null ? String.valueOf(serviceInstance.getPort())
: managementPort;
String cluster = getClusterName(s... | [
"Instance",
"marshall",
"(",
"ServiceInstance",
"serviceInstance",
")",
"{",
"String",
"hostname",
"=",
"serviceInstance",
".",
"getHost",
"(",
")",
";",
"String",
"managementPort",
"=",
"serviceInstance",
".",
"getMetadata",
"(",
")",
".",
"get",
"(",
"\"manage... | Private helper that marshals the information from each instance into something that
Turbine can understand. Override this method for your own implementation.
@param serviceInstance whose information should be marshaled
@return Instance | [
"Private",
"helper",
"that",
"marshals",
"the",
"information",
"from",
"each",
"instance",
"into",
"something",
"that",
"Turbine",
"can",
"understand",
".",
"Override",
"this",
"method",
"for",
"your",
"own",
"implementation",
"."
] | 03b1e326ce5971c41239890dc71cae616366cff8 | https://github.com/spring-cloud/spring-cloud-netflix/blob/03b1e326ce5971c41239890dc71cae616366cff8/spring-cloud-netflix-turbine/src/main/java/org/springframework/cloud/netflix/turbine/CommonsInstanceDiscovery.java#L171-L191 |
130,219 | spring-cloud/spring-cloud-netflix | spring-cloud-netflix-turbine/src/main/java/org/springframework/cloud/netflix/turbine/CommonsInstanceDiscovery.java | CommonsInstanceDiscovery.getClusterName | protected String getClusterName(Object object) {
StandardEvaluationContext context = new StandardEvaluationContext(object);
Object value = this.clusterNameExpression.getValue(context);
if (value != null) {
return value.toString();
}
return null;
} | java | protected String getClusterName(Object object) {
StandardEvaluationContext context = new StandardEvaluationContext(object);
Object value = this.clusterNameExpression.getValue(context);
if (value != null) {
return value.toString();
}
return null;
} | [
"protected",
"String",
"getClusterName",
"(",
"Object",
"object",
")",
"{",
"StandardEvaluationContext",
"context",
"=",
"new",
"StandardEvaluationContext",
"(",
"object",
")",
";",
"Object",
"value",
"=",
"this",
".",
"clusterNameExpression",
".",
"getValue",
"(",
... | Helper that fetches the cluster name. Cluster is a Turbine concept and not a
commons concept. By default we choose the amazon serviceId as the cluster. A custom
implementation can be plugged in by overriding this method.
@param object cluster whose name should be evaluated
@return String name of the cluster | [
"Helper",
"that",
"fetches",
"the",
"cluster",
"name",
".",
"Cluster",
"is",
"a",
"Turbine",
"concept",
"and",
"not",
"a",
"commons",
"concept",
".",
"By",
"default",
"we",
"choose",
"the",
"amazon",
"serviceId",
"as",
"the",
"cluster",
".",
"A",
"custom",... | 03b1e326ce5971c41239890dc71cae616366cff8 | https://github.com/spring-cloud/spring-cloud-netflix/blob/03b1e326ce5971c41239890dc71cae616366cff8/spring-cloud-netflix-turbine/src/main/java/org/springframework/cloud/netflix/turbine/CommonsInstanceDiscovery.java#L225-L232 |
130,220 | spring-cloud/spring-cloud-netflix | spring-cloud-netflix-eureka-client/src/main/java/org/springframework/cloud/netflix/ribbon/eureka/ZoneUtils.java | ZoneUtils.extractApproximateZone | public static String extractApproximateZone(String host) {
String[] split = StringUtils.split(host, ".");
return split == null ? host : split[1];
} | java | public static String extractApproximateZone(String host) {
String[] split = StringUtils.split(host, ".");
return split == null ? host : split[1];
} | [
"public",
"static",
"String",
"extractApproximateZone",
"(",
"String",
"host",
")",
"{",
"String",
"[",
"]",
"split",
"=",
"StringUtils",
".",
"split",
"(",
"host",
",",
"\".\"",
")",
";",
"return",
"split",
"==",
"null",
"?",
"host",
":",
"split",
"[",
... | Approximates Eureka zones from a host name. This method approximates the zone to be
everything after the first "." in the host name.
@param host The host name to extract the host name from
@return The approximate zone | [
"Approximates",
"Eureka",
"zones",
"from",
"a",
"host",
"name",
".",
"This",
"method",
"approximates",
"the",
"zone",
"to",
"be",
"everything",
"after",
"the",
"first",
".",
"in",
"the",
"host",
"name",
"."
] | 03b1e326ce5971c41239890dc71cae616366cff8 | https://github.com/spring-cloud/spring-cloud-netflix/blob/03b1e326ce5971c41239890dc71cae616366cff8/spring-cloud-netflix-eureka-client/src/main/java/org/springframework/cloud/netflix/ribbon/eureka/ZoneUtils.java#L39-L42 |
130,221 | spring-cloud/spring-cloud-netflix | spring-cloud-netflix-concurrency-limits/src/main/java/org/springframework/cloud/netflix/concurrency/limits/reactive/ServerWebExchangeLimiterBuilder.java | ServerWebExchangeLimiterBuilder.partitionByHeader | public ServerWebExchangeLimiterBuilder partitionByHeader(String name) {
return partitionResolver(
exchange -> exchange.getRequest().getHeaders().getFirst(name));
} | java | public ServerWebExchangeLimiterBuilder partitionByHeader(String name) {
return partitionResolver(
exchange -> exchange.getRequest().getHeaders().getFirst(name));
} | [
"public",
"ServerWebExchangeLimiterBuilder",
"partitionByHeader",
"(",
"String",
"name",
")",
"{",
"return",
"partitionResolver",
"(",
"exchange",
"->",
"exchange",
".",
"getRequest",
"(",
")",
".",
"getHeaders",
"(",
")",
".",
"getFirst",
"(",
"name",
")",
")",... | Partition the limit by header.
@param name header name
@return Chainable builder | [
"Partition",
"the",
"limit",
"by",
"header",
"."
] | 03b1e326ce5971c41239890dc71cae616366cff8 | https://github.com/spring-cloud/spring-cloud-netflix/blob/03b1e326ce5971c41239890dc71cae616366cff8/spring-cloud-netflix-concurrency-limits/src/main/java/org/springframework/cloud/netflix/concurrency/limits/reactive/ServerWebExchangeLimiterBuilder.java#L39-L42 |
130,222 | spring-cloud/spring-cloud-netflix | spring-cloud-netflix-concurrency-limits/src/main/java/org/springframework/cloud/netflix/concurrency/limits/reactive/ServerWebExchangeLimiterBuilder.java | ServerWebExchangeLimiterBuilder.partitionByParameter | public ServerWebExchangeLimiterBuilder partitionByParameter(String name) {
return partitionResolver(
exchange -> exchange.getRequest().getQueryParams().getFirst(name));
} | java | public ServerWebExchangeLimiterBuilder partitionByParameter(String name) {
return partitionResolver(
exchange -> exchange.getRequest().getQueryParams().getFirst(name));
} | [
"public",
"ServerWebExchangeLimiterBuilder",
"partitionByParameter",
"(",
"String",
"name",
")",
"{",
"return",
"partitionResolver",
"(",
"exchange",
"->",
"exchange",
".",
"getRequest",
"(",
")",
".",
"getQueryParams",
"(",
")",
".",
"getFirst",
"(",
"name",
")",... | Partition the limit by request parameter.
@param name parameter name
@return Chainable builder | [
"Partition",
"the",
"limit",
"by",
"request",
"parameter",
"."
] | 03b1e326ce5971c41239890dc71cae616366cff8 | https://github.com/spring-cloud/spring-cloud-netflix/blob/03b1e326ce5971c41239890dc71cae616366cff8/spring-cloud-netflix-concurrency-limits/src/main/java/org/springframework/cloud/netflix/concurrency/limits/reactive/ServerWebExchangeLimiterBuilder.java#L75-L78 |
130,223 | spring-cloud/spring-cloud-netflix | spring-cloud-netflix-eureka-server/src/main/java/org/springframework/cloud/netflix/eureka/server/EurekaServerAutoConfiguration.java | EurekaServerAutoConfiguration.jerseyFilterRegistration | @Bean
public FilterRegistrationBean jerseyFilterRegistration(
javax.ws.rs.core.Application eurekaJerseyApp) {
FilterRegistrationBean bean = new FilterRegistrationBean();
bean.setFilter(new ServletContainer(eurekaJerseyApp));
bean.setOrder(Ordered.LOWEST_PRECEDENCE);
bean.setUrlPatterns(
Collections.sing... | java | @Bean
public FilterRegistrationBean jerseyFilterRegistration(
javax.ws.rs.core.Application eurekaJerseyApp) {
FilterRegistrationBean bean = new FilterRegistrationBean();
bean.setFilter(new ServletContainer(eurekaJerseyApp));
bean.setOrder(Ordered.LOWEST_PRECEDENCE);
bean.setUrlPatterns(
Collections.sing... | [
"@",
"Bean",
"public",
"FilterRegistrationBean",
"jerseyFilterRegistration",
"(",
"javax",
".",
"ws",
".",
"rs",
".",
"core",
".",
"Application",
"eurekaJerseyApp",
")",
"{",
"FilterRegistrationBean",
"bean",
"=",
"new",
"FilterRegistrationBean",
"(",
")",
";",
"b... | Register the Jersey filter.
@param eurekaJerseyApp an {@link Application} for the filter to be registered
@return a jersey {@link FilterRegistrationBean} | [
"Register",
"the",
"Jersey",
"filter",
"."
] | 03b1e326ce5971c41239890dc71cae616366cff8 | https://github.com/spring-cloud/spring-cloud-netflix/blob/03b1e326ce5971c41239890dc71cae616366cff8/spring-cloud-netflix-eureka-server/src/main/java/org/springframework/cloud/netflix/eureka/server/EurekaServerAutoConfiguration.java#L180-L190 |
130,224 | spring-cloud/spring-cloud-netflix | spring-cloud-netflix-zuul/src/main/java/org/springframework/cloud/netflix/zuul/filters/discovery/PatternServiceRouteMapper.java | PatternServiceRouteMapper.apply | @Override
public String apply(String serviceId) {
Matcher matcher = this.servicePattern.matcher(serviceId);
String route = matcher.replaceFirst(this.routePattern);
route = cleanRoute(route);
return (StringUtils.hasText(route) ? route : serviceId);
} | java | @Override
public String apply(String serviceId) {
Matcher matcher = this.servicePattern.matcher(serviceId);
String route = matcher.replaceFirst(this.routePattern);
route = cleanRoute(route);
return (StringUtils.hasText(route) ? route : serviceId);
} | [
"@",
"Override",
"public",
"String",
"apply",
"(",
"String",
"serviceId",
")",
"{",
"Matcher",
"matcher",
"=",
"this",
".",
"servicePattern",
".",
"matcher",
"(",
"serviceId",
")",
";",
"String",
"route",
"=",
"matcher",
".",
"replaceFirst",
"(",
"this",
"... | Use servicePattern to extract groups and routePattern to construct the route.
If there is no matches, the serviceId is returned.
@param serviceId service discovered name
@return route path | [
"Use",
"servicePattern",
"to",
"extract",
"groups",
"and",
"routePattern",
"to",
"construct",
"the",
"route",
"."
] | 03b1e326ce5971c41239890dc71cae616366cff8 | https://github.com/spring-cloud/spring-cloud-netflix/blob/03b1e326ce5971c41239890dc71cae616366cff8/spring-cloud-netflix-zuul/src/main/java/org/springframework/cloud/netflix/zuul/filters/discovery/PatternServiceRouteMapper.java#L66-L72 |
130,225 | spring-cloud/spring-cloud-netflix | spring-cloud-netflix-turbine/src/main/java/org/springframework/cloud/netflix/turbine/EurekaInstanceDiscovery.java | EurekaInstanceDiscovery.getInstancesForApp | @Override
protected List<Instance> getInstancesForApp(String serviceId) throws Exception {
List<Instance> instances = new ArrayList<>();
log.info("Fetching instances for app: " + serviceId);
Application app = eurekaClient.getApplication(serviceId);
if (app == null) {
log.warn("Eureka returned null for app: ... | java | @Override
protected List<Instance> getInstancesForApp(String serviceId) throws Exception {
List<Instance> instances = new ArrayList<>();
log.info("Fetching instances for app: " + serviceId);
Application app = eurekaClient.getApplication(serviceId);
if (app == null) {
log.warn("Eureka returned null for app: ... | [
"@",
"Override",
"protected",
"List",
"<",
"Instance",
">",
"getInstancesForApp",
"(",
"String",
"serviceId",
")",
"throws",
"Exception",
"{",
"List",
"<",
"Instance",
">",
"instances",
"=",
"new",
"ArrayList",
"<>",
"(",
")",
";",
"log",
".",
"info",
"(",... | Private helper that fetches the Instances for each application.
@param serviceId of the service that the instance list should be returned for
@return List of instances for a given service id
@throws Exception - retrieving and marshalling service instances may result in an
Exception | [
"Private",
"helper",
"that",
"fetches",
"the",
"Instances",
"for",
"each",
"application",
"."
] | 03b1e326ce5971c41239890dc71cae616366cff8 | https://github.com/spring-cloud/spring-cloud-netflix/blob/03b1e326ce5971c41239890dc71cae616366cff8/spring-cloud-netflix-turbine/src/main/java/org/springframework/cloud/netflix/turbine/EurekaInstanceDiscovery.java#L69-L95 |
130,226 | spring-cloud/spring-cloud-netflix | spring-cloud-netflix-turbine/src/main/java/org/springframework/cloud/netflix/turbine/EurekaInstanceDiscovery.java | EurekaInstanceDiscovery.marshall | Instance marshall(InstanceInfo instanceInfo) {
String hostname = instanceInfo.getHostName();
final String managementPort = instanceInfo.getMetadata().get("management.port");
String port = managementPort == null ? String.valueOf(instanceInfo.getPort())
: managementPort;
String cluster = getClusterName(instan... | java | Instance marshall(InstanceInfo instanceInfo) {
String hostname = instanceInfo.getHostName();
final String managementPort = instanceInfo.getMetadata().get("management.port");
String port = managementPort == null ? String.valueOf(instanceInfo.getPort())
: managementPort;
String cluster = getClusterName(instan... | [
"Instance",
"marshall",
"(",
"InstanceInfo",
"instanceInfo",
")",
"{",
"String",
"hostname",
"=",
"instanceInfo",
".",
"getHostName",
"(",
")",
";",
"final",
"String",
"managementPort",
"=",
"instanceInfo",
".",
"getMetadata",
"(",
")",
".",
"get",
"(",
"\"man... | Private helper that marshals the information from each instance into something that
Turbine can understand. Override this method for your own implementation for
parsing Eureka info.
@param instanceInfo {@link InstanceInfo} to marshal
@return {@link Instance} marshaled from provided {@link InstanceInfo} | [
"Private",
"helper",
"that",
"marshals",
"the",
"information",
"from",
"each",
"instance",
"into",
"something",
"that",
"Turbine",
"can",
"understand",
".",
"Override",
"this",
"method",
"for",
"your",
"own",
"implementation",
"for",
"parsing",
"Eureka",
"info",
... | 03b1e326ce5971c41239890dc71cae616366cff8 | https://github.com/spring-cloud/spring-cloud-netflix/blob/03b1e326ce5971c41239890dc71cae616366cff8/spring-cloud-netflix-turbine/src/main/java/org/springframework/cloud/netflix/turbine/EurekaInstanceDiscovery.java#L104-L139 |
130,227 | spring-cloud/spring-cloud-netflix | spring-cloud-netflix-turbine/src/main/java/org/springframework/cloud/netflix/turbine/EurekaInstanceDiscovery.java | EurekaInstanceDiscovery.parseInstanceStatus | protected Boolean parseInstanceStatus(InstanceStatus status) {
if (status == null) {
return null;
}
return status == InstanceStatus.UP;
} | java | protected Boolean parseInstanceStatus(InstanceStatus status) {
if (status == null) {
return null;
}
return status == InstanceStatus.UP;
} | [
"protected",
"Boolean",
"parseInstanceStatus",
"(",
"InstanceStatus",
"status",
")",
"{",
"if",
"(",
"status",
"==",
"null",
")",
"{",
"return",
"null",
";",
"}",
"return",
"status",
"==",
"InstanceStatus",
".",
"UP",
";",
"}"
] | Helper that returns whether the instance is Up of Down.
@param status {@link InstanceStatus} instance to evaluate the status from
@return {@code true} if {@link InstanceStatus} is UP | [
"Helper",
"that",
"returns",
"whether",
"the",
"instance",
"is",
"Up",
"of",
"Down",
"."
] | 03b1e326ce5971c41239890dc71cae616366cff8 | https://github.com/spring-cloud/spring-cloud-netflix/blob/03b1e326ce5971c41239890dc71cae616366cff8/spring-cloud-netflix-turbine/src/main/java/org/springframework/cloud/netflix/turbine/EurekaInstanceDiscovery.java#L146-L151 |
130,228 | spring-cloud/spring-cloud-netflix | spring-cloud-netflix-zuul/src/main/java/org/springframework/cloud/netflix/zuul/filters/route/SimpleHostRoutingFilter.java | SimpleHostRoutingFilter.getContentLength | protected long getContentLength(HttpServletRequest request) {
if (useServlet31) {
return request.getContentLengthLong();
}
String contentLengthHeader = request.getHeader(HttpHeaders.CONTENT_LENGTH);
if (contentLengthHeader != null) {
try {
return Long.parseLong(contentLengthHeader);
}
catch (Num... | java | protected long getContentLength(HttpServletRequest request) {
if (useServlet31) {
return request.getContentLengthLong();
}
String contentLengthHeader = request.getHeader(HttpHeaders.CONTENT_LENGTH);
if (contentLengthHeader != null) {
try {
return Long.parseLong(contentLengthHeader);
}
catch (Num... | [
"protected",
"long",
"getContentLength",
"(",
"HttpServletRequest",
"request",
")",
"{",
"if",
"(",
"useServlet31",
")",
"{",
"return",
"request",
".",
"getContentLengthLong",
"(",
")",
";",
"}",
"String",
"contentLengthHeader",
"=",
"request",
".",
"getHeader",
... | Get the header value as a long in order to more correctly proxy very large requests | [
"Get",
"the",
"header",
"value",
"as",
"a",
"long",
"in",
"order",
"to",
"more",
"correctly",
"proxy",
"very",
"large",
"requests"
] | 03b1e326ce5971c41239890dc71cae616366cff8 | https://github.com/spring-cloud/spring-cloud-netflix/blob/03b1e326ce5971c41239890dc71cae616366cff8/spring-cloud-netflix-zuul/src/main/java/org/springframework/cloud/netflix/zuul/filters/route/SimpleHostRoutingFilter.java#L462-L475 |
130,229 | rzwitserloot/lombok | src/delombok/lombok/delombok/FormatPreferenceScanner.java | FormatPreferenceScanner.tryEasy | private FormatPreferences tryEasy(FormatPreferences preferences, boolean force) {
int count = 0;
for (Map.Entry<String, String> e : preferences.rawMap.entrySet()) {
if (!"scan".equalsIgnoreCase(e.getValue())) count++;
}
if (force || count >= FormatPreferences.KEYS.size()) return preferences;
return null;
... | java | private FormatPreferences tryEasy(FormatPreferences preferences, boolean force) {
int count = 0;
for (Map.Entry<String, String> e : preferences.rawMap.entrySet()) {
if (!"scan".equalsIgnoreCase(e.getValue())) count++;
}
if (force || count >= FormatPreferences.KEYS.size()) return preferences;
return null;
... | [
"private",
"FormatPreferences",
"tryEasy",
"(",
"FormatPreferences",
"preferences",
",",
"boolean",
"force",
")",
"{",
"int",
"count",
"=",
"0",
";",
"for",
"(",
"Map",
".",
"Entry",
"<",
"String",
",",
"String",
">",
"e",
":",
"preferences",
".",
"rawMap"... | Checks validity of preferences, and returns with a non-null value if ALL format keys are available, thus negating the need for a scan. | [
"Checks",
"validity",
"of",
"preferences",
"and",
"returns",
"with",
"a",
"non",
"-",
"null",
"value",
"if",
"ALL",
"format",
"keys",
"are",
"available",
"thus",
"negating",
"the",
"need",
"for",
"a",
"scan",
"."
] | 75601240760bd81ff95fcde7a1b8185769ce64e8 | https://github.com/rzwitserloot/lombok/blob/75601240760bd81ff95fcde7a1b8185769ce64e8/src/delombok/lombok/delombok/FormatPreferenceScanner.java#L40-L47 |
130,230 | rzwitserloot/lombok | src/utils/lombok/javac/Javac.java | Javac.calculateGuess | public static Object calculateGuess(JCExpression expr) {
if (expr instanceof JCLiteral) {
JCLiteral lit = (JCLiteral) expr;
if (lit.getKind() == com.sun.source.tree.Tree.Kind.BOOLEAN_LITERAL) {
return ((Number) lit.value).intValue() == 0 ? false : true;
}
return lit.value;
}
if (expr instanceof... | java | public static Object calculateGuess(JCExpression expr) {
if (expr instanceof JCLiteral) {
JCLiteral lit = (JCLiteral) expr;
if (lit.getKind() == com.sun.source.tree.Tree.Kind.BOOLEAN_LITERAL) {
return ((Number) lit.value).intValue() == 0 ? false : true;
}
return lit.value;
}
if (expr instanceof... | [
"public",
"static",
"Object",
"calculateGuess",
"(",
"JCExpression",
"expr",
")",
"{",
"if",
"(",
"expr",
"instanceof",
"JCLiteral",
")",
"{",
"JCLiteral",
"lit",
"=",
"(",
"JCLiteral",
")",
"expr",
";",
"if",
"(",
"lit",
".",
"getKind",
"(",
")",
"==",
... | Turns an expression into a guessed intended literal. Only works for
literals, as you can imagine.
Will for example turn a TrueLiteral into 'Boolean.valueOf(true)'. | [
"Turns",
"an",
"expression",
"into",
"a",
"guessed",
"intended",
"literal",
".",
"Only",
"works",
"for",
"literals",
"as",
"you",
"can",
"imagine",
"."
] | 75601240760bd81ff95fcde7a1b8185769ce64e8 | https://github.com/rzwitserloot/lombok/blob/75601240760bd81ff95fcde7a1b8185769ce64e8/src/utils/lombok/javac/Javac.java#L148-L166 |
130,231 | rzwitserloot/lombok | src/installer/lombok/installer/IdeLocation.java | IdeLocation.canonical | public static String canonical(File p) {
try {
return p.getCanonicalPath();
} catch (IOException e) {
String x = p.getAbsolutePath();
return x == null ? p.getPath() : x;
}
} | java | public static String canonical(File p) {
try {
return p.getCanonicalPath();
} catch (IOException e) {
String x = p.getAbsolutePath();
return x == null ? p.getPath() : x;
}
} | [
"public",
"static",
"String",
"canonical",
"(",
"File",
"p",
")",
"{",
"try",
"{",
"return",
"p",
".",
"getCanonicalPath",
"(",
")",
";",
"}",
"catch",
"(",
"IOException",
"e",
")",
"{",
"String",
"x",
"=",
"p",
".",
"getAbsolutePath",
"(",
")",
";",... | Returns a full path to the provided file.
Returns the canonical path, unless that is not available, in which case it returns the absolute path. | [
"Returns",
"a",
"full",
"path",
"to",
"the",
"provided",
"file",
".",
"Returns",
"the",
"canonical",
"path",
"unless",
"that",
"is",
"not",
"available",
"in",
"which",
"case",
"it",
"returns",
"the",
"absolute",
"path",
"."
] | 75601240760bd81ff95fcde7a1b8185769ce64e8 | https://github.com/rzwitserloot/lombok/blob/75601240760bd81ff95fcde7a1b8185769ce64e8/src/installer/lombok/installer/IdeLocation.java#L59-L66 |
130,232 | rzwitserloot/lombok | src/core/lombok/core/LombokNode.java | LombokNode.up | public L up() {
L result = parent;
while (result != null && !result.isStructurallySignificant) result = result.parent;
return result;
} | java | public L up() {
L result = parent;
while (result != null && !result.isStructurallySignificant) result = result.parent;
return result;
} | [
"public",
"L",
"up",
"(",
")",
"{",
"L",
"result",
"=",
"parent",
";",
"while",
"(",
"result",
"!=",
"null",
"&&",
"!",
"result",
".",
"isStructurallySignificant",
")",
"result",
"=",
"result",
".",
"parent",
";",
"return",
"result",
";",
"}"
] | Returns the structurally significant node that encloses this one.
@see #isStructurallySignificant() | [
"Returns",
"the",
"structurally",
"significant",
"node",
"that",
"encloses",
"this",
"one",
"."
] | 75601240760bd81ff95fcde7a1b8185769ce64e8 | https://github.com/rzwitserloot/lombok/blob/75601240760bd81ff95fcde7a1b8185769ce64e8/src/core/lombok/core/LombokNode.java#L143-L147 |
130,233 | rzwitserloot/lombok | src/core/lombok/core/LombokNode.java | LombokNode.add | @SuppressWarnings({"unchecked"})
public L add(N newChild, Kind newChildKind) {
getAst().setChanged();
L n = getAst().buildTree(newChild, newChildKind);
if (n == null) return null;
n.parent = (L) this;
children = children.append(n);
return n;
} | java | @SuppressWarnings({"unchecked"})
public L add(N newChild, Kind newChildKind) {
getAst().setChanged();
L n = getAst().buildTree(newChild, newChildKind);
if (n == null) return null;
n.parent = (L) this;
children = children.append(n);
return n;
} | [
"@",
"SuppressWarnings",
"(",
"{",
"\"unchecked\"",
"}",
")",
"public",
"L",
"add",
"(",
"N",
"newChild",
",",
"Kind",
"newChildKind",
")",
"{",
"getAst",
"(",
")",
".",
"setChanged",
"(",
")",
";",
"L",
"n",
"=",
"getAst",
"(",
")",
".",
"buildTree"... | Adds the stated node as a direct child of this node.
Does not change the underlying (javac/Eclipse) AST, only the wrapped view. | [
"Adds",
"the",
"stated",
"node",
"as",
"a",
"direct",
"child",
"of",
"this",
"node",
"."
] | 75601240760bd81ff95fcde7a1b8185769ce64e8 | https://github.com/rzwitserloot/lombok/blob/75601240760bd81ff95fcde7a1b8185769ce64e8/src/core/lombok/core/LombokNode.java#L230-L238 |
130,234 | rzwitserloot/lombok | src/core/lombok/core/LombokNode.java | LombokNode.rebuild | public void rebuild() {
Map<N, L> oldNodes = new IdentityHashMap<N, L>();
gatherAndRemoveChildren(oldNodes);
L newNode = getAst().buildTree(get(), kind);
getAst().setChanged();
getAst().replaceNewWithExistingOld(oldNodes, newNode);
} | java | public void rebuild() {
Map<N, L> oldNodes = new IdentityHashMap<N, L>();
gatherAndRemoveChildren(oldNodes);
L newNode = getAst().buildTree(get(), kind);
getAst().setChanged();
getAst().replaceNewWithExistingOld(oldNodes, newNode);
} | [
"public",
"void",
"rebuild",
"(",
")",
"{",
"Map",
"<",
"N",
",",
"L",
">",
"oldNodes",
"=",
"new",
"IdentityHashMap",
"<",
"N",
",",
"L",
">",
"(",
")",
";",
"gatherAndRemoveChildren",
"(",
"oldNodes",
")",
";",
"L",
"newNode",
"=",
"getAst",
"(",
... | Reparses the AST node represented by this node. Any existing nodes that occupy a different space in the AST are rehomed, any
nodes that no longer exist are removed, and new nodes are created.
Careful - the node you call this on must not itself have been removed or rehomed - it rebuilds <i>all children</i>. | [
"Reparses",
"the",
"AST",
"node",
"represented",
"by",
"this",
"node",
".",
"Any",
"existing",
"nodes",
"that",
"occupy",
"a",
"different",
"space",
"in",
"the",
"AST",
"are",
"rehomed",
"any",
"nodes",
"that",
"no",
"longer",
"exist",
"are",
"removed",
"a... | 75601240760bd81ff95fcde7a1b8185769ce64e8 | https://github.com/rzwitserloot/lombok/blob/75601240760bd81ff95fcde7a1b8185769ce64e8/src/core/lombok/core/LombokNode.java#L246-L255 |
130,235 | rzwitserloot/lombok | src/core/lombok/javac/handlers/JavacHandlerUtil.java | JavacHandlerUtil.annotationTypeMatches | public static boolean annotationTypeMatches(Class<? extends Annotation> type, JavacNode node) {
if (node.getKind() != Kind.ANNOTATION) return false;
return typeMatches(type, node, ((JCAnnotation) node.get()).annotationType);
} | java | public static boolean annotationTypeMatches(Class<? extends Annotation> type, JavacNode node) {
if (node.getKind() != Kind.ANNOTATION) return false;
return typeMatches(type, node, ((JCAnnotation) node.get()).annotationType);
} | [
"public",
"static",
"boolean",
"annotationTypeMatches",
"(",
"Class",
"<",
"?",
"extends",
"Annotation",
">",
"type",
",",
"JavacNode",
"node",
")",
"{",
"if",
"(",
"node",
".",
"getKind",
"(",
")",
"!=",
"Kind",
".",
"ANNOTATION",
")",
"return",
"false",
... | Checks if the Annotation AST Node provided is likely to be an instance of the provided annotation type.
@param type An actual annotation type, such as {@code lombok.Getter.class}.
@param node A Lombok AST node representing an annotation in source code. | [
"Checks",
"if",
"the",
"Annotation",
"AST",
"Node",
"provided",
"is",
"likely",
"to",
"be",
"an",
"instance",
"of",
"the",
"provided",
"annotation",
"type",
"."
] | 75601240760bd81ff95fcde7a1b8185769ce64e8 | https://github.com/rzwitserloot/lombok/blob/75601240760bd81ff95fcde7a1b8185769ce64e8/src/core/lombok/javac/handlers/JavacHandlerUtil.java#L268-L271 |
130,236 | rzwitserloot/lombok | src/core/lombok/javac/handlers/JavacHandlerUtil.java | JavacHandlerUtil.fieldExists | public static MemberExistsResult fieldExists(String fieldName, JavacNode node) {
node = upToTypeNode(node);
if (node != null && node.get() instanceof JCClassDecl) {
for (JCTree def : ((JCClassDecl)node.get()).defs) {
if (def instanceof JCVariableDecl) {
if (((JCVariableDecl)def).name.contentEquals(fi... | java | public static MemberExistsResult fieldExists(String fieldName, JavacNode node) {
node = upToTypeNode(node);
if (node != null && node.get() instanceof JCClassDecl) {
for (JCTree def : ((JCClassDecl)node.get()).defs) {
if (def instanceof JCVariableDecl) {
if (((JCVariableDecl)def).name.contentEquals(fi... | [
"public",
"static",
"MemberExistsResult",
"fieldExists",
"(",
"String",
"fieldName",
",",
"JavacNode",
"node",
")",
"{",
"node",
"=",
"upToTypeNode",
"(",
"node",
")",
";",
"if",
"(",
"node",
"!=",
"null",
"&&",
"node",
".",
"get",
"(",
")",
"instanceof",
... | Checks if there is a field with the provided name.
@param fieldName the field name to check for.
@param node Any node that represents the Type (JCClassDecl) to look in, or any child node thereof. | [
"Checks",
"if",
"there",
"is",
"a",
"field",
"with",
"the",
"provided",
"name",
"."
] | 75601240760bd81ff95fcde7a1b8185769ce64e8 | https://github.com/rzwitserloot/lombok/blob/75601240760bd81ff95fcde7a1b8185769ce64e8/src/core/lombok/javac/handlers/JavacHandlerUtil.java#L705-L719 |
130,237 | rzwitserloot/lombok | src/core/lombok/javac/handlers/JavacHandlerUtil.java | JavacHandlerUtil.getFieldType | static JCExpression getFieldType(JavacNode field, FieldAccess fieldAccess) {
if (field.getKind() == Kind.METHOD) return ((JCMethodDecl) field.get()).restype;
boolean lookForGetter = lookForGetter(field, fieldAccess);
GetterMethod getter = lookForGetter ? findGetter(field) : null;
if (getter == null) {
... | java | static JCExpression getFieldType(JavacNode field, FieldAccess fieldAccess) {
if (field.getKind() == Kind.METHOD) return ((JCMethodDecl) field.get()).restype;
boolean lookForGetter = lookForGetter(field, fieldAccess);
GetterMethod getter = lookForGetter ? findGetter(field) : null;
if (getter == null) {
... | [
"static",
"JCExpression",
"getFieldType",
"(",
"JavacNode",
"field",
",",
"FieldAccess",
"fieldAccess",
")",
"{",
"if",
"(",
"field",
".",
"getKind",
"(",
")",
"==",
"Kind",
".",
"METHOD",
")",
"return",
"(",
"(",
"JCMethodDecl",
")",
"field",
".",
"get",
... | Returns the type of the field, unless a getter exists for this field, in which case the return type of the getter is returned.
@see #createFieldAccessor(TreeMaker, JavacNode, FieldAccess) | [
"Returns",
"the",
"type",
"of",
"the",
"field",
"unless",
"a",
"getter",
"exists",
"for",
"this",
"field",
"in",
"which",
"case",
"the",
"return",
"type",
"of",
"the",
"getter",
"is",
"returned",
"."
] | 75601240760bd81ff95fcde7a1b8185769ce64e8 | https://github.com/rzwitserloot/lombok/blob/75601240760bd81ff95fcde7a1b8185769ce64e8/src/core/lombok/javac/handlers/JavacHandlerUtil.java#L924-L936 |
130,238 | rzwitserloot/lombok | src/core/lombok/javac/handlers/JavacHandlerUtil.java | JavacHandlerUtil.injectField | public static JavacNode injectField(JavacNode typeNode, JCVariableDecl field) {
return injectField(typeNode, field, false);
} | java | public static JavacNode injectField(JavacNode typeNode, JCVariableDecl field) {
return injectField(typeNode, field, false);
} | [
"public",
"static",
"JavacNode",
"injectField",
"(",
"JavacNode",
"typeNode",
",",
"JCVariableDecl",
"field",
")",
"{",
"return",
"injectField",
"(",
"typeNode",
",",
"field",
",",
"false",
")",
";",
"}"
] | Adds the given new field declaration to the provided type AST Node.
Also takes care of updating the JavacAST. | [
"Adds",
"the",
"given",
"new",
"field",
"declaration",
"to",
"the",
"provided",
"type",
"AST",
"Node",
"."
] | 75601240760bd81ff95fcde7a1b8185769ce64e8 | https://github.com/rzwitserloot/lombok/blob/75601240760bd81ff95fcde7a1b8185769ce64e8/src/core/lombok/javac/handlers/JavacHandlerUtil.java#L1015-L1017 |
130,239 | rzwitserloot/lombok | src/core/lombok/javac/handlers/JavacHandlerUtil.java | JavacHandlerUtil.injectMethod | public static void injectMethod(JavacNode typeNode, JCMethodDecl method, List<Type> paramTypes, Type returnType) {
JCClassDecl type = (JCClassDecl) typeNode.get();
if (method.getName().contentEquals("<init>")) {
//Scan for default constructor, and remove it.
int idx = 0;
for (JCTree def : type.defs) {
... | java | public static void injectMethod(JavacNode typeNode, JCMethodDecl method, List<Type> paramTypes, Type returnType) {
JCClassDecl type = (JCClassDecl) typeNode.get();
if (method.getName().contentEquals("<init>")) {
//Scan for default constructor, and remove it.
int idx = 0;
for (JCTree def : type.defs) {
... | [
"public",
"static",
"void",
"injectMethod",
"(",
"JavacNode",
"typeNode",
",",
"JCMethodDecl",
"method",
",",
"List",
"<",
"Type",
">",
"paramTypes",
",",
"Type",
"returnType",
")",
"{",
"JCClassDecl",
"type",
"=",
"(",
"JCClassDecl",
")",
"typeNode",
".",
"... | Adds the given new method declaration to the provided type AST Node.
Can also inject constructors.
Also takes care of updating the JavacAST. | [
"Adds",
"the",
"given",
"new",
"method",
"declaration",
"to",
"the",
"provided",
"type",
"AST",
"Node",
".",
"Can",
"also",
"inject",
"constructors",
"."
] | 75601240760bd81ff95fcde7a1b8185769ce64e8 | https://github.com/rzwitserloot/lombok/blob/75601240760bd81ff95fcde7a1b8185769ce64e8/src/core/lombok/javac/handlers/JavacHandlerUtil.java#L1162-L1189 |
130,240 | rzwitserloot/lombok | src/core/lombok/javac/handlers/JavacHandlerUtil.java | JavacHandlerUtil.createListOfNonExistentFields | public static List<Integer> createListOfNonExistentFields(List<String> list, JavacNode type, boolean excludeStandard, boolean excludeTransient) {
boolean[] matched = new boolean[list.size()];
for (JavacNode child : type.down()) {
if (list.isEmpty()) break;
if (child.getKind() != Kind.FIELD) continue;
JC... | java | public static List<Integer> createListOfNonExistentFields(List<String> list, JavacNode type, boolean excludeStandard, boolean excludeTransient) {
boolean[] matched = new boolean[list.size()];
for (JavacNode child : type.down()) {
if (list.isEmpty()) break;
if (child.getKind() != Kind.FIELD) continue;
JC... | [
"public",
"static",
"List",
"<",
"Integer",
">",
"createListOfNonExistentFields",
"(",
"List",
"<",
"String",
">",
"list",
",",
"JavacNode",
"type",
",",
"boolean",
"excludeStandard",
",",
"boolean",
"excludeTransient",
")",
"{",
"boolean",
"[",
"]",
"matched",
... | Given a list of field names and a node referring to a type, finds each name in the list that does not match a field within the type. | [
"Given",
"a",
"list",
"of",
"field",
"names",
"and",
"a",
"node",
"referring",
"to",
"a",
"type",
"finds",
"each",
"name",
"in",
"the",
"list",
"that",
"does",
"not",
"match",
"a",
"field",
"within",
"the",
"type",
"."
] | 75601240760bd81ff95fcde7a1b8185769ce64e8 | https://github.com/rzwitserloot/lombok/blob/75601240760bd81ff95fcde7a1b8185769ce64e8/src/core/lombok/javac/handlers/JavacHandlerUtil.java#L1505-L1528 |
130,241 | rzwitserloot/lombok | src/core/lombok/bytecode/ClassFileMetaData.java | ClassFileMetaData.usesField | public boolean usesField(String className, String fieldName) {
int classIndex = findClass(className);
if (classIndex == NOT_FOUND) return false;
int fieldNameIndex = findUtf8(fieldName);
if (fieldNameIndex == NOT_FOUND) return false;
for (int i = 1; i < maxPoolSize; i++) {
if (types[i] == FIELD && readV... | java | public boolean usesField(String className, String fieldName) {
int classIndex = findClass(className);
if (classIndex == NOT_FOUND) return false;
int fieldNameIndex = findUtf8(fieldName);
if (fieldNameIndex == NOT_FOUND) return false;
for (int i = 1; i < maxPoolSize; i++) {
if (types[i] == FIELD && readV... | [
"public",
"boolean",
"usesField",
"(",
"String",
"className",
",",
"String",
"fieldName",
")",
"{",
"int",
"classIndex",
"=",
"findClass",
"(",
"className",
")",
";",
"if",
"(",
"classIndex",
"==",
"NOT_FOUND",
")",
"return",
"false",
";",
"int",
"fieldNameI... | Checks if the constant pool contains a reference to a given field, either for writing or reading.
@param className must be provided JVM-style, such as {@code java/lang/String} | [
"Checks",
"if",
"the",
"constant",
"pool",
"contains",
"a",
"reference",
"to",
"a",
"given",
"field",
"either",
"for",
"writing",
"or",
"reading",
"."
] | 75601240760bd81ff95fcde7a1b8185769ce64e8 | https://github.com/rzwitserloot/lombok/blob/75601240760bd81ff95fcde7a1b8185769ce64e8/src/core/lombok/bytecode/ClassFileMetaData.java#L164-L177 |
130,242 | rzwitserloot/lombok | src/core/lombok/bytecode/ClassFileMetaData.java | ClassFileMetaData.usesMethod | public boolean usesMethod(String className, String methodName, String descriptor) {
int classIndex = findClass(className);
if (classIndex == NOT_FOUND) return false;
int nameAndTypeIndex = findNameAndType(methodName, descriptor);
if (nameAndTypeIndex == NOT_FOUND) return false;
for (int i = 1; i < maxPoolS... | java | public boolean usesMethod(String className, String methodName, String descriptor) {
int classIndex = findClass(className);
if (classIndex == NOT_FOUND) return false;
int nameAndTypeIndex = findNameAndType(methodName, descriptor);
if (nameAndTypeIndex == NOT_FOUND) return false;
for (int i = 1; i < maxPoolS... | [
"public",
"boolean",
"usesMethod",
"(",
"String",
"className",
",",
"String",
"methodName",
",",
"String",
"descriptor",
")",
"{",
"int",
"classIndex",
"=",
"findClass",
"(",
"className",
")",
";",
"if",
"(",
"classIndex",
"==",
"NOT_FOUND",
")",
"return",
"... | Checks if the constant pool contains a reference to a given method.
@param className must be provided JVM-style, such as {@code java/lang/String}
@param descriptor must be provided JVM-style, such as {@code (IZ)Ljava/lang/String;} | [
"Checks",
"if",
"the",
"constant",
"pool",
"contains",
"a",
"reference",
"to",
"a",
"given",
"method",
"."
] | 75601240760bd81ff95fcde7a1b8185769ce64e8 | https://github.com/rzwitserloot/lombok/blob/75601240760bd81ff95fcde7a1b8185769ce64e8/src/core/lombok/bytecode/ClassFileMetaData.java#L205-L217 |
130,243 | rzwitserloot/lombok | src/core/lombok/bytecode/ClassFileMetaData.java | ClassFileMetaData.containsStringConstant | public boolean containsStringConstant(String value) {
int index = findUtf8(value);
if (index == NOT_FOUND) return false;
for (int i = 1; i < maxPoolSize; i++) {
if (types[i] == STRING && readValue(offsets[i]) == index) return true;
}
return false;
} | java | public boolean containsStringConstant(String value) {
int index = findUtf8(value);
if (index == NOT_FOUND) return false;
for (int i = 1; i < maxPoolSize; i++) {
if (types[i] == STRING && readValue(offsets[i]) == index) return true;
}
return false;
} | [
"public",
"boolean",
"containsStringConstant",
"(",
"String",
"value",
")",
"{",
"int",
"index",
"=",
"findUtf8",
"(",
"value",
")",
";",
"if",
"(",
"index",
"==",
"NOT_FOUND",
")",
"return",
"false",
";",
"for",
"(",
"int",
"i",
"=",
"1",
";",
"i",
... | Checks if the constant pool contains the provided string constant, which implies the constant is used somewhere in the code.
NB: String literals get concatenated by the compiler.
NB2: This method does NOT do any kind of normalization. | [
"Checks",
"if",
"the",
"constant",
"pool",
"contains",
"the",
"provided",
"string",
"constant",
"which",
"implies",
"the",
"constant",
"is",
"used",
"somewhere",
"in",
"the",
"code",
"."
] | 75601240760bd81ff95fcde7a1b8185769ce64e8 | https://github.com/rzwitserloot/lombok/blob/75601240760bd81ff95fcde7a1b8185769ce64e8/src/core/lombok/bytecode/ClassFileMetaData.java#L225-L232 |
130,244 | rzwitserloot/lombok | src/core/lombok/bytecode/ClassFileMetaData.java | ClassFileMetaData.containsLong | public boolean containsLong(long value) {
for (int i = 1; i < maxPoolSize; i++) {
if (types[i] == LONG && readLong(i) == value) return true;
}
return false;
} | java | public boolean containsLong(long value) {
for (int i = 1; i < maxPoolSize; i++) {
if (types[i] == LONG && readLong(i) == value) return true;
}
return false;
} | [
"public",
"boolean",
"containsLong",
"(",
"long",
"value",
")",
"{",
"for",
"(",
"int",
"i",
"=",
"1",
";",
"i",
"<",
"maxPoolSize",
";",
"i",
"++",
")",
"{",
"if",
"(",
"types",
"[",
"i",
"]",
"==",
"LONG",
"&&",
"readLong",
"(",
"i",
")",
"==... | Checks if the constant pool contains the provided long constant, which implies the constant is used somewhere in the code.
NB: compile-time constant expressions are evaluated at compile time. | [
"Checks",
"if",
"the",
"constant",
"pool",
"contains",
"the",
"provided",
"long",
"constant",
"which",
"implies",
"the",
"constant",
"is",
"used",
"somewhere",
"in",
"the",
"code",
"."
] | 75601240760bd81ff95fcde7a1b8185769ce64e8 | https://github.com/rzwitserloot/lombok/blob/75601240760bd81ff95fcde7a1b8185769ce64e8/src/core/lombok/bytecode/ClassFileMetaData.java#L239-L244 |
130,245 | rzwitserloot/lombok | src/core/lombok/bytecode/ClassFileMetaData.java | ClassFileMetaData.containsDouble | public boolean containsDouble(double value) {
boolean isNan = Double.isNaN(value);
for (int i = 1; i < maxPoolSize; i++) {
if (types[i] == DOUBLE) {
double d = readDouble(i);
if (d == value || (isNan && Double.isNaN(d))) return true;
}
}
return false;
} | java | public boolean containsDouble(double value) {
boolean isNan = Double.isNaN(value);
for (int i = 1; i < maxPoolSize; i++) {
if (types[i] == DOUBLE) {
double d = readDouble(i);
if (d == value || (isNan && Double.isNaN(d))) return true;
}
}
return false;
} | [
"public",
"boolean",
"containsDouble",
"(",
"double",
"value",
")",
"{",
"boolean",
"isNan",
"=",
"Double",
".",
"isNaN",
"(",
"value",
")",
";",
"for",
"(",
"int",
"i",
"=",
"1",
";",
"i",
"<",
"maxPoolSize",
";",
"i",
"++",
")",
"{",
"if",
"(",
... | Checks if the constant pool contains the provided double constant, which implies the constant is used somewhere in the code.
NB: compile-time constant expressions are evaluated at compile time. | [
"Checks",
"if",
"the",
"constant",
"pool",
"contains",
"the",
"provided",
"double",
"constant",
"which",
"implies",
"the",
"constant",
"is",
"used",
"somewhere",
"in",
"the",
"code",
"."
] | 75601240760bd81ff95fcde7a1b8185769ce64e8 | https://github.com/rzwitserloot/lombok/blob/75601240760bd81ff95fcde7a1b8185769ce64e8/src/core/lombok/bytecode/ClassFileMetaData.java#L251-L260 |
130,246 | rzwitserloot/lombok | src/core/lombok/bytecode/ClassFileMetaData.java | ClassFileMetaData.containsInteger | public boolean containsInteger(int value) {
for (int i = 1; i < maxPoolSize; i++) {
if (types[i] == INTEGER && readInteger(i) == value) return true;
}
return false;
} | java | public boolean containsInteger(int value) {
for (int i = 1; i < maxPoolSize; i++) {
if (types[i] == INTEGER && readInteger(i) == value) return true;
}
return false;
} | [
"public",
"boolean",
"containsInteger",
"(",
"int",
"value",
")",
"{",
"for",
"(",
"int",
"i",
"=",
"1",
";",
"i",
"<",
"maxPoolSize",
";",
"i",
"++",
")",
"{",
"if",
"(",
"types",
"[",
"i",
"]",
"==",
"INTEGER",
"&&",
"readInteger",
"(",
"i",
")... | Checks if the constant pool contains the provided int constant, which implies the constant is used somewhere in the code.
NB: compile-time constant expressions are evaluated at compile time. | [
"Checks",
"if",
"the",
"constant",
"pool",
"contains",
"the",
"provided",
"int",
"constant",
"which",
"implies",
"the",
"constant",
"is",
"used",
"somewhere",
"in",
"the",
"code",
"."
] | 75601240760bd81ff95fcde7a1b8185769ce64e8 | https://github.com/rzwitserloot/lombok/blob/75601240760bd81ff95fcde7a1b8185769ce64e8/src/core/lombok/bytecode/ClassFileMetaData.java#L267-L272 |
130,247 | rzwitserloot/lombok | src/core/lombok/bytecode/ClassFileMetaData.java | ClassFileMetaData.containsFloat | public boolean containsFloat(float value) {
boolean isNan = Float.isNaN(value);
for (int i = 1; i < maxPoolSize; i++) {
if (types[i] == FLOAT) {
float f = readFloat(i);
if (f == value || (isNan && Float.isNaN(f))) return true;
}
}
return false;
} | java | public boolean containsFloat(float value) {
boolean isNan = Float.isNaN(value);
for (int i = 1; i < maxPoolSize; i++) {
if (types[i] == FLOAT) {
float f = readFloat(i);
if (f == value || (isNan && Float.isNaN(f))) return true;
}
}
return false;
} | [
"public",
"boolean",
"containsFloat",
"(",
"float",
"value",
")",
"{",
"boolean",
"isNan",
"=",
"Float",
".",
"isNaN",
"(",
"value",
")",
";",
"for",
"(",
"int",
"i",
"=",
"1",
";",
"i",
"<",
"maxPoolSize",
";",
"i",
"++",
")",
"{",
"if",
"(",
"t... | Checks if the constant pool contains the provided float constant, which implies the constant is used somewhere in the code.
NB: compile-time constant expressions are evaluated at compile time. | [
"Checks",
"if",
"the",
"constant",
"pool",
"contains",
"the",
"provided",
"float",
"constant",
"which",
"implies",
"the",
"constant",
"is",
"used",
"somewhere",
"in",
"the",
"code",
"."
] | 75601240760bd81ff95fcde7a1b8185769ce64e8 | https://github.com/rzwitserloot/lombok/blob/75601240760bd81ff95fcde7a1b8185769ce64e8/src/core/lombok/bytecode/ClassFileMetaData.java#L279-L288 |
130,248 | rzwitserloot/lombok | src/core/lombok/bytecode/ClassFileMetaData.java | ClassFileMetaData.getInterfaces | public List<String> getInterfaces() {
int size = readValue(endOfPool + 6);
if (size == 0) return Collections.emptyList();
List<String> result = new ArrayList<String>();
for (int i = 0; i < size; i++) {
result.add(getClassName(readValue(endOfPool + 8 + (i * 2))));
}
return result;
} | java | public List<String> getInterfaces() {
int size = readValue(endOfPool + 6);
if (size == 0) return Collections.emptyList();
List<String> result = new ArrayList<String>();
for (int i = 0; i < size; i++) {
result.add(getClassName(readValue(endOfPool + 8 + (i * 2))));
}
return result;
} | [
"public",
"List",
"<",
"String",
">",
"getInterfaces",
"(",
")",
"{",
"int",
"size",
"=",
"readValue",
"(",
"endOfPool",
"+",
"6",
")",
";",
"if",
"(",
"size",
"==",
"0",
")",
"return",
"Collections",
".",
"emptyList",
"(",
")",
";",
"List",
"<",
"... | Returns the name of all implemented interfaces. | [
"Returns",
"the",
"name",
"of",
"all",
"implemented",
"interfaces",
"."
] | 75601240760bd81ff95fcde7a1b8185769ce64e8 | https://github.com/rzwitserloot/lombok/blob/75601240760bd81ff95fcde7a1b8185769ce64e8/src/core/lombok/bytecode/ClassFileMetaData.java#L331-L340 |
130,249 | rzwitserloot/lombok | src/core/lombok/eclipse/handlers/HandleEqualsAndHashCode.java | HandleEqualsAndHashCode.longToIntForHashCode | public Expression longToIntForHashCode(Expression ref1, Expression ref2, ASTNode source) {
int pS = source.sourceStart, pE = source.sourceEnd;
/* (int)(ref >>> 32 ^ ref) */
IntLiteral int32 = makeIntLiteral("32".toCharArray(), source);
BinaryExpression higherBits = new BinaryExpression(ref1, int32, OperatorIds.... | java | public Expression longToIntForHashCode(Expression ref1, Expression ref2, ASTNode source) {
int pS = source.sourceStart, pE = source.sourceEnd;
/* (int)(ref >>> 32 ^ ref) */
IntLiteral int32 = makeIntLiteral("32".toCharArray(), source);
BinaryExpression higherBits = new BinaryExpression(ref1, int32, OperatorIds.... | [
"public",
"Expression",
"longToIntForHashCode",
"(",
"Expression",
"ref1",
",",
"Expression",
"ref2",
",",
"ASTNode",
"source",
")",
"{",
"int",
"pS",
"=",
"source",
".",
"sourceStart",
",",
"pE",
"=",
"source",
".",
"sourceEnd",
";",
"/* (int)(ref >>> 32 ^ ref)... | Give 2 clones! | [
"Give",
"2",
"clones!"
] | 75601240760bd81ff95fcde7a1b8185769ce64e8 | https://github.com/rzwitserloot/lombok/blob/75601240760bd81ff95fcde7a1b8185769ce64e8/src/core/lombok/eclipse/handlers/HandleEqualsAndHashCode.java#L815-L829 |
130,250 | rzwitserloot/lombok | src/core/lombok/javac/apt/LombokProcessor.java | LombokProcessor.listAnnotationProcessorsBeforeOurs | @SuppressWarnings("unused")
private String listAnnotationProcessorsBeforeOurs() {
try {
Object discoveredProcessors = javacProcessingEnvironment_discoveredProcs.get(this.javacProcessingEnv);
ArrayList<?> states = (ArrayList<?>) discoveredProcessors_procStateList.get(discoveredProcessors);
if (states == null... | java | @SuppressWarnings("unused")
private String listAnnotationProcessorsBeforeOurs() {
try {
Object discoveredProcessors = javacProcessingEnvironment_discoveredProcs.get(this.javacProcessingEnv);
ArrayList<?> states = (ArrayList<?>) discoveredProcessors_procStateList.get(discoveredProcessors);
if (states == null... | [
"@",
"SuppressWarnings",
"(",
"\"unused\"",
")",
"private",
"String",
"listAnnotationProcessorsBeforeOurs",
"(",
")",
"{",
"try",
"{",
"Object",
"discoveredProcessors",
"=",
"javacProcessingEnvironment_discoveredProcs",
".",
"get",
"(",
"this",
".",
"javacProcessingEnv",
... | Hence, for now, no warnings. | [
"Hence",
"for",
"now",
"no",
"warnings",
"."
] | 75601240760bd81ff95fcde7a1b8185769ce64e8 | https://github.com/rzwitserloot/lombok/blob/75601240760bd81ff95fcde7a1b8185769ce64e8/src/core/lombok/javac/apt/LombokProcessor.java#L127-L147 |
130,251 | rzwitserloot/lombok | src/core/lombok/javac/apt/LombokProcessor.java | LombokProcessor.getJavacProcessingEnvironment | public JavacProcessingEnvironment getJavacProcessingEnvironment(Object procEnv) {
if (procEnv instanceof JavacProcessingEnvironment) return (JavacProcessingEnvironment) procEnv;
// try to find a "delegate" field in the object, and use this to try to obtain a JavacProcessingEnvironment
for (Class<?> procEnvClas... | java | public JavacProcessingEnvironment getJavacProcessingEnvironment(Object procEnv) {
if (procEnv instanceof JavacProcessingEnvironment) return (JavacProcessingEnvironment) procEnv;
// try to find a "delegate" field in the object, and use this to try to obtain a JavacProcessingEnvironment
for (Class<?> procEnvClas... | [
"public",
"JavacProcessingEnvironment",
"getJavacProcessingEnvironment",
"(",
"Object",
"procEnv",
")",
"{",
"if",
"(",
"procEnv",
"instanceof",
"JavacProcessingEnvironment",
")",
"return",
"(",
"JavacProcessingEnvironment",
")",
"procEnv",
";",
"// try to find a \"delegate\"... | This class casts the given processing environment to a JavacProcessingEnvironment. In case of
gradle incremental compilation, the delegate ProcessingEnvironment of the gradle wrapper is returned. | [
"This",
"class",
"casts",
"the",
"given",
"processing",
"environment",
"to",
"a",
"JavacProcessingEnvironment",
".",
"In",
"case",
"of",
"gradle",
"incremental",
"compilation",
"the",
"delegate",
"ProcessingEnvironment",
"of",
"the",
"gradle",
"wrapper",
"is",
"retu... | 75601240760bd81ff95fcde7a1b8185769ce64e8 | https://github.com/rzwitserloot/lombok/blob/75601240760bd81ff95fcde7a1b8185769ce64e8/src/core/lombok/javac/apt/LombokProcessor.java#L409-L424 |
130,252 | rzwitserloot/lombok | src/installer/lombok/installer/OsUtils.java | OsUtils.getDrivesOnWindows | public static List<String> getDrivesOnWindows() throws Throwable {
loadWindowsDriveInfoLib();
List<String> drives = new ArrayList<String>();
WindowsDriveInfo info = new WindowsDriveInfo();
for (String drive : info.getLogicalDrives()) {
if (info.isFixedDisk(drive)) drives.add(drive);
}
return dri... | java | public static List<String> getDrivesOnWindows() throws Throwable {
loadWindowsDriveInfoLib();
List<String> drives = new ArrayList<String>();
WindowsDriveInfo info = new WindowsDriveInfo();
for (String drive : info.getLogicalDrives()) {
if (info.isFixedDisk(drive)) drives.add(drive);
}
return dri... | [
"public",
"static",
"List",
"<",
"String",
">",
"getDrivesOnWindows",
"(",
")",
"throws",
"Throwable",
"{",
"loadWindowsDriveInfoLib",
"(",
")",
";",
"List",
"<",
"String",
">",
"drives",
"=",
"new",
"ArrayList",
"<",
"String",
">",
"(",
")",
";",
"Windows... | Returns all drive letters on windows that represent fixed disks.
Floppy drives, optical drives, USB sticks, and network drives should all be excluded.
@return A List of drive letters, such as ["C", "D", "X"]. | [
"Returns",
"all",
"drive",
"letters",
"on",
"windows",
"that",
"represent",
"fixed",
"disks",
"."
] | 75601240760bd81ff95fcde7a1b8185769ce64e8 | https://github.com/rzwitserloot/lombok/blob/75601240760bd81ff95fcde7a1b8185769ce64e8/src/installer/lombok/installer/OsUtils.java#L102-L113 |
130,253 | rzwitserloot/lombok | src/core/lombok/eclipse/TransformEclipseAST.java | TransformEclipseAST.transform | public static void transform(Parser parser, CompilationUnitDeclaration ast) {
if (disableLombok) return;
if (Symbols.hasSymbol("lombok.disable")) return;
// Do NOT abort if (ast.bits & ASTNode.HasAllMethodBodies) != 0 - that doesn't work.
if (Boolean.TRUE.equals(LombokConfiguration.read(ConfigurationKe... | java | public static void transform(Parser parser, CompilationUnitDeclaration ast) {
if (disableLombok) return;
if (Symbols.hasSymbol("lombok.disable")) return;
// Do NOT abort if (ast.bits & ASTNode.HasAllMethodBodies) != 0 - that doesn't work.
if (Boolean.TRUE.equals(LombokConfiguration.read(ConfigurationKe... | [
"public",
"static",
"void",
"transform",
"(",
"Parser",
"parser",
",",
"CompilationUnitDeclaration",
"ast",
")",
"{",
"if",
"(",
"disableLombok",
")",
"return",
";",
"if",
"(",
"Symbols",
".",
"hasSymbol",
"(",
"\"lombok.disable\"",
")",
")",
"return",
";",
... | This method is called immediately after Eclipse finishes building a CompilationUnitDeclaration, which is
the top-level AST node when Eclipse parses a source file. The signature is 'magic' - you should not
change it!
Eclipse's parsers often operate in diet mode, which means many parts of the AST have been left blank.
B... | [
"This",
"method",
"is",
"called",
"immediately",
"after",
"Eclipse",
"finishes",
"building",
"a",
"CompilationUnitDeclaration",
"which",
"is",
"the",
"top",
"-",
"level",
"AST",
"node",
"when",
"Eclipse",
"parses",
"a",
"source",
"file",
".",
"The",
"signature",... | 75601240760bd81ff95fcde7a1b8185769ce64e8 | https://github.com/rzwitserloot/lombok/blob/75601240760bd81ff95fcde7a1b8185769ce64e8/src/core/lombok/eclipse/TransformEclipseAST.java#L143-L180 |
130,254 | rzwitserloot/lombok | src/core/lombok/eclipse/TransformEclipseAST.java | TransformEclipseAST.go | public void go() {
long nextPriority = Long.MIN_VALUE;
for (Long d : handlers.getPriorities()) {
if (nextPriority > d) continue;
AnnotationVisitor visitor = new AnnotationVisitor(d);
ast.traverse(visitor);
// if no visitor interested for this AST, nextPriority would be MAX_VALUE and we bail out immediat... | java | public void go() {
long nextPriority = Long.MIN_VALUE;
for (Long d : handlers.getPriorities()) {
if (nextPriority > d) continue;
AnnotationVisitor visitor = new AnnotationVisitor(d);
ast.traverse(visitor);
// if no visitor interested for this AST, nextPriority would be MAX_VALUE and we bail out immediat... | [
"public",
"void",
"go",
"(",
")",
"{",
"long",
"nextPriority",
"=",
"Long",
".",
"MIN_VALUE",
";",
"for",
"(",
"Long",
"d",
":",
"handlers",
".",
"getPriorities",
"(",
")",
")",
"{",
"if",
"(",
"nextPriority",
">",
"d",
")",
"continue",
";",
"Annotat... | First handles all lombok annotations except PrintAST, then calls all non-annotation based handlers.
then handles any PrintASTs. | [
"First",
"handles",
"all",
"lombok",
"annotations",
"except",
"PrintAST",
"then",
"calls",
"all",
"non",
"-",
"annotation",
"based",
"handlers",
".",
"then",
"handles",
"any",
"PrintASTs",
"."
] | 75601240760bd81ff95fcde7a1b8185769ce64e8 | https://github.com/rzwitserloot/lombok/blob/75601240760bd81ff95fcde7a1b8185769ce64e8/src/core/lombok/eclipse/TransformEclipseAST.java#L190-L200 |
130,255 | rzwitserloot/lombok | src/utils/lombok/eclipse/Eclipse.java | Eclipse.isPrimitive | public static boolean isPrimitive(TypeReference ref) {
if (ref.dimensions() > 0) return false;
return PRIMITIVE_TYPE_NAME_PATTERN.matcher(toQualifiedName(ref.getTypeName())).matches();
} | java | public static boolean isPrimitive(TypeReference ref) {
if (ref.dimensions() > 0) return false;
return PRIMITIVE_TYPE_NAME_PATTERN.matcher(toQualifiedName(ref.getTypeName())).matches();
} | [
"public",
"static",
"boolean",
"isPrimitive",
"(",
"TypeReference",
"ref",
")",
"{",
"if",
"(",
"ref",
".",
"dimensions",
"(",
")",
">",
"0",
")",
"return",
"false",
";",
"return",
"PRIMITIVE_TYPE_NAME_PATTERN",
".",
"matcher",
"(",
"toQualifiedName",
"(",
"... | Checks if the given type reference represents a primitive type. | [
"Checks",
"if",
"the",
"given",
"type",
"reference",
"represents",
"a",
"primitive",
"type",
"."
] | 75601240760bd81ff95fcde7a1b8185769ce64e8 | https://github.com/rzwitserloot/lombok/blob/75601240760bd81ff95fcde7a1b8185769ce64e8/src/utils/lombok/eclipse/Eclipse.java#L165-L168 |
130,256 | rzwitserloot/lombok | src/utils/lombok/eclipse/Eclipse.java | Eclipse.calculateValue | public static Object calculateValue(Expression e) {
if (e instanceof Literal) {
((Literal) e).computeConstant();
switch (e.constant.typeID()) {
case TypeIds.T_int: return e.constant.intValue();
case TypeIds.T_byte: return e.constant.byteValue();
case TypeIds.T_short: return e.constant.shortValue();
... | java | public static Object calculateValue(Expression e) {
if (e instanceof Literal) {
((Literal) e).computeConstant();
switch (e.constant.typeID()) {
case TypeIds.T_int: return e.constant.intValue();
case TypeIds.T_byte: return e.constant.byteValue();
case TypeIds.T_short: return e.constant.shortValue();
... | [
"public",
"static",
"Object",
"calculateValue",
"(",
"Expression",
"e",
")",
"{",
"if",
"(",
"e",
"instanceof",
"Literal",
")",
"{",
"(",
"(",
"Literal",
")",
"e",
")",
".",
"computeConstant",
"(",
")",
";",
"switch",
"(",
"e",
".",
"constant",
".",
... | Returns the actual value of the given Literal or Literal-like node. | [
"Returns",
"the",
"actual",
"value",
"of",
"the",
"given",
"Literal",
"or",
"Literal",
"-",
"like",
"node",
"."
] | 75601240760bd81ff95fcde7a1b8185769ce64e8 | https://github.com/rzwitserloot/lombok/blob/75601240760bd81ff95fcde7a1b8185769ce64e8/src/utils/lombok/eclipse/Eclipse.java#L173-L210 |
130,257 | rzwitserloot/lombok | src/core/lombok/javac/HandlerLibrary.java | HandlerLibrary.load | public static HandlerLibrary load(Messager messager, Trees trees) {
HandlerLibrary library = new HandlerLibrary(messager);
try {
loadAnnotationHandlers(library, trees);
loadVisitorHandlers(library, trees);
} catch (IOException e) {
System.err.println("Lombok isn't running due to misconfigured SPI file... | java | public static HandlerLibrary load(Messager messager, Trees trees) {
HandlerLibrary library = new HandlerLibrary(messager);
try {
loadAnnotationHandlers(library, trees);
loadVisitorHandlers(library, trees);
} catch (IOException e) {
System.err.println("Lombok isn't running due to misconfigured SPI file... | [
"public",
"static",
"HandlerLibrary",
"load",
"(",
"Messager",
"messager",
",",
"Trees",
"trees",
")",
"{",
"HandlerLibrary",
"library",
"=",
"new",
"HandlerLibrary",
"(",
"messager",
")",
";",
"try",
"{",
"loadAnnotationHandlers",
"(",
"library",
",",
"trees",
... | Creates a new HandlerLibrary that will report any problems or errors to the provided messager,
then uses SPI discovery to load all annotation and visitor based handlers so that future calls
to the handle methods will defer to these handlers. | [
"Creates",
"a",
"new",
"HandlerLibrary",
"that",
"will",
"report",
"any",
"problems",
"or",
"errors",
"to",
"the",
"provided",
"messager",
"then",
"uses",
"SPI",
"discovery",
"to",
"load",
"all",
"annotation",
"and",
"visitor",
"based",
"handlers",
"so",
"that... | 75601240760bd81ff95fcde7a1b8185769ce64e8 | https://github.com/rzwitserloot/lombok/blob/75601240760bd81ff95fcde7a1b8185769ce64e8/src/core/lombok/javac/HandlerLibrary.java#L162-L175 |
130,258 | rzwitserloot/lombok | src/core/lombok/javac/HandlerLibrary.java | HandlerLibrary.javacWarning | public void javacWarning(String message, Throwable t) {
messager.printMessage(Diagnostic.Kind.WARNING, message + (t == null ? "" : (": " + t)));
} | java | public void javacWarning(String message, Throwable t) {
messager.printMessage(Diagnostic.Kind.WARNING, message + (t == null ? "" : (": " + t)));
} | [
"public",
"void",
"javacWarning",
"(",
"String",
"message",
",",
"Throwable",
"t",
")",
"{",
"messager",
".",
"printMessage",
"(",
"Diagnostic",
".",
"Kind",
".",
"WARNING",
",",
"message",
"+",
"(",
"t",
"==",
"null",
"?",
"\"\"",
":",
"(",
"\": \"",
... | Generates a warning in the Messager that was used to initialize this HandlerLibrary. | [
"Generates",
"a",
"warning",
"in",
"the",
"Messager",
"that",
"was",
"used",
"to",
"initialize",
"this",
"HandlerLibrary",
"."
] | 75601240760bd81ff95fcde7a1b8185769ce64e8 | https://github.com/rzwitserloot/lombok/blob/75601240760bd81ff95fcde7a1b8185769ce64e8/src/core/lombok/javac/HandlerLibrary.java#L208-L210 |
130,259 | rzwitserloot/lombok | src/core/lombok/javac/HandlerLibrary.java | HandlerLibrary.javacError | public void javacError(String message, Throwable t) {
messager.printMessage(Diagnostic.Kind.ERROR, message + (t == null ? "" : (": " + t)));
if (t != null) t.printStackTrace();
} | java | public void javacError(String message, Throwable t) {
messager.printMessage(Diagnostic.Kind.ERROR, message + (t == null ? "" : (": " + t)));
if (t != null) t.printStackTrace();
} | [
"public",
"void",
"javacError",
"(",
"String",
"message",
",",
"Throwable",
"t",
")",
"{",
"messager",
".",
"printMessage",
"(",
"Diagnostic",
".",
"Kind",
".",
"ERROR",
",",
"message",
"+",
"(",
"t",
"==",
"null",
"?",
"\"\"",
":",
"(",
"\": \"",
"+",... | Generates an error in the Messager that was used to initialize this HandlerLibrary. | [
"Generates",
"an",
"error",
"in",
"the",
"Messager",
"that",
"was",
"used",
"to",
"initialize",
"this",
"HandlerLibrary",
"."
] | 75601240760bd81ff95fcde7a1b8185769ce64e8 | https://github.com/rzwitserloot/lombok/blob/75601240760bd81ff95fcde7a1b8185769ce64e8/src/core/lombok/javac/HandlerLibrary.java#L218-L221 |
130,260 | rzwitserloot/lombok | src/utils/lombok/javac/JavacTreeMaker.java | JavacTreeMaker.MethodId | static <J> MethodId<J> MethodId(String name, Class<J> returnType, Class<?>... types) {
return new MethodId<J>(TreeMaker.class, name, returnType, types);
} | java | static <J> MethodId<J> MethodId(String name, Class<J> returnType, Class<?>... types) {
return new MethodId<J>(TreeMaker.class, name, returnType, types);
} | [
"static",
"<",
"J",
">",
"MethodId",
"<",
"J",
">",
"MethodId",
"(",
"String",
"name",
",",
"Class",
"<",
"J",
">",
"returnType",
",",
"Class",
"<",
"?",
">",
"...",
"types",
")",
"{",
"return",
"new",
"MethodId",
"<",
"J",
">",
"(",
"TreeMaker",
... | Creates a new method ID based on the name of the method to invoke, the return type of that method, and the types of the parameters.
A method matches if the return type matches, and for each parameter the following holds:
Either (A) the type listed here is the same as, or a subtype of, the type of the method in javac'... | [
"Creates",
"a",
"new",
"method",
"ID",
"based",
"on",
"the",
"name",
"of",
"the",
"method",
"to",
"invoke",
"the",
"return",
"type",
"of",
"that",
"method",
"and",
"the",
"types",
"of",
"the",
"parameters",
"."
] | 75601240760bd81ff95fcde7a1b8185769ce64e8 | https://github.com/rzwitserloot/lombok/blob/75601240760bd81ff95fcde7a1b8185769ce64e8/src/utils/lombok/javac/JavacTreeMaker.java#L315-L317 |
130,261 | rzwitserloot/lombok | src/installer/lombok/installer/InstallerGUI.java | InstallerGUI.show | public void show() {
appWindow.setVisible(true);
if (OsUtils.getOS() == OS.MAC_OS_X) {
try {
AppleNativeLook.go();
} catch (Throwable ignore) {
//We're just prettying up the app. If it fails, meh.
}
}
} | java | public void show() {
appWindow.setVisible(true);
if (OsUtils.getOS() == OS.MAC_OS_X) {
try {
AppleNativeLook.go();
} catch (Throwable ignore) {
//We're just prettying up the app. If it fails, meh.
}
}
} | [
"public",
"void",
"show",
"(",
")",
"{",
"appWindow",
".",
"setVisible",
"(",
"true",
")",
";",
"if",
"(",
"OsUtils",
".",
"getOS",
"(",
")",
"==",
"OS",
".",
"MAC_OS_X",
")",
"{",
"try",
"{",
"AppleNativeLook",
".",
"go",
"(",
")",
";",
"}",
"ca... | Makes the installer window visible. | [
"Makes",
"the",
"installer",
"window",
"visible",
"."
] | 75601240760bd81ff95fcde7a1b8185769ce64e8 | https://github.com/rzwitserloot/lombok/blob/75601240760bd81ff95fcde7a1b8185769ce64e8/src/installer/lombok/installer/InstallerGUI.java#L892-L901 |
130,262 | rzwitserloot/lombok | src/delombok/lombok/delombok/DocCommentIntegrator.java | DocCommentIntegrator.integrate | public List<CommentInfo> integrate(List<CommentInfo> comments, JCCompilationUnit unit) {
List<CommentInfo> out = new ArrayList<CommentInfo>();
CommentInfo lastExcisedComment = null;
JCTree lastNode = null;
for (CommentInfo cmt : comments) {
if (!cmt.isJavadoc()) {
out.add(cmt);
continue;
}
... | java | public List<CommentInfo> integrate(List<CommentInfo> comments, JCCompilationUnit unit) {
List<CommentInfo> out = new ArrayList<CommentInfo>();
CommentInfo lastExcisedComment = null;
JCTree lastNode = null;
for (CommentInfo cmt : comments) {
if (!cmt.isJavadoc()) {
out.add(cmt);
continue;
}
... | [
"public",
"List",
"<",
"CommentInfo",
">",
"integrate",
"(",
"List",
"<",
"CommentInfo",
">",
"comments",
",",
"JCCompilationUnit",
"unit",
")",
"{",
"List",
"<",
"CommentInfo",
">",
"out",
"=",
"new",
"ArrayList",
"<",
"CommentInfo",
">",
"(",
")",
";",
... | Returns the same comment list as when this integrator was created, minus all doc comments that have been successfully integrated into the compilation unit. | [
"Returns",
"the",
"same",
"comment",
"list",
"as",
"when",
"this",
"integrator",
"was",
"created",
"minus",
"all",
"doc",
"comments",
"that",
"have",
"been",
"successfully",
"integrated",
"into",
"the",
"compilation",
"unit",
"."
] | 75601240760bd81ff95fcde7a1b8185769ce64e8 | https://github.com/rzwitserloot/lombok/blob/75601240760bd81ff95fcde7a1b8185769ce64e8/src/delombok/lombok/delombok/DocCommentIntegrator.java#L47-L75 |
130,263 | rzwitserloot/lombok | src/installer/lombok/installer/eclipse/EclipseProductLocation.java | EclipseProductLocation.getUninstallDirs | private List<File> getUninstallDirs() {
List<File> result = new ArrayList<File>();
File x = new File(name);
if (!x.isDirectory()) x = x.getParentFile();
if (x.isDirectory()) result.add(x);
result.add(eclipseIniPath.getParentFile());
return result;
} | java | private List<File> getUninstallDirs() {
List<File> result = new ArrayList<File>();
File x = new File(name);
if (!x.isDirectory()) x = x.getParentFile();
if (x.isDirectory()) result.add(x);
result.add(eclipseIniPath.getParentFile());
return result;
} | [
"private",
"List",
"<",
"File",
">",
"getUninstallDirs",
"(",
")",
"{",
"List",
"<",
"File",
">",
"result",
"=",
"new",
"ArrayList",
"<",
"File",
">",
"(",
")",
";",
"File",
"x",
"=",
"new",
"File",
"(",
"name",
")",
";",
"if",
"(",
"!",
"x",
"... | Returns directories that may contain lombok.jar files that need to be deleted. | [
"Returns",
"directories",
"that",
"may",
"contain",
"lombok",
".",
"jar",
"files",
"that",
"need",
"to",
"be",
"deleted",
"."
] | 75601240760bd81ff95fcde7a1b8185769ce64e8 | https://github.com/rzwitserloot/lombok/blob/75601240760bd81ff95fcde7a1b8185769ce64e8/src/installer/lombok/installer/eclipse/EclipseProductLocation.java#L133-L140 |
130,264 | rzwitserloot/lombok | src/core/lombok/core/configuration/ConfigurationKey.java | ConfigurationKey.registeredKeys | @SuppressWarnings("unchecked")
public static Map<String, ConfigurationKey<?>> registeredKeys() {
synchronized (registeredKeys) {
if (copy == null) copy = Collections.unmodifiableMap((Map<String, ConfigurationKey<?>>) registeredKeys.clone());
return copy;
}
} | java | @SuppressWarnings("unchecked")
public static Map<String, ConfigurationKey<?>> registeredKeys() {
synchronized (registeredKeys) {
if (copy == null) copy = Collections.unmodifiableMap((Map<String, ConfigurationKey<?>>) registeredKeys.clone());
return copy;
}
} | [
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"public",
"static",
"Map",
"<",
"String",
",",
"ConfigurationKey",
"<",
"?",
">",
">",
"registeredKeys",
"(",
")",
"{",
"synchronized",
"(",
"registeredKeys",
")",
"{",
"if",
"(",
"copy",
"==",
"null",
")... | Returns a copy of the currently registered keys. | [
"Returns",
"a",
"copy",
"of",
"the",
"currently",
"registered",
"keys",
"."
] | 75601240760bd81ff95fcde7a1b8185769ce64e8 | https://github.com/rzwitserloot/lombok/blob/75601240760bd81ff95fcde7a1b8185769ce64e8/src/core/lombok/core/configuration/ConfigurationKey.java#L91-L97 |
130,265 | rzwitserloot/lombok | src/core/lombok/core/TypeLibrary.java | TypeLibrary.addType | public void addType(String fullyQualifiedTypeName) {
String dotBased = fullyQualifiedTypeName.replace("$", ".");
if (locked) throw new IllegalStateException("locked");
int idx = fullyQualifiedTypeName.lastIndexOf('.');
if (idx == -1) throw new IllegalArgumentException(
"Only fully qualified types are all... | java | public void addType(String fullyQualifiedTypeName) {
String dotBased = fullyQualifiedTypeName.replace("$", ".");
if (locked) throw new IllegalStateException("locked");
int idx = fullyQualifiedTypeName.lastIndexOf('.');
if (idx == -1) throw new IllegalArgumentException(
"Only fully qualified types are all... | [
"public",
"void",
"addType",
"(",
"String",
"fullyQualifiedTypeName",
")",
"{",
"String",
"dotBased",
"=",
"fullyQualifiedTypeName",
".",
"replace",
"(",
"\"$\"",
",",
"\".\"",
")",
";",
"if",
"(",
"locked",
")",
"throw",
"new",
"IllegalStateException",
"(",
"... | Add a type to the library.
@param fullyQualifiedTypeName the FQN type name, such as 'java.lang.String'. | [
"Add",
"a",
"type",
"to",
"the",
"library",
"."
] | 75601240760bd81ff95fcde7a1b8185769ce64e8 | https://github.com/rzwitserloot/lombok/blob/75601240760bd81ff95fcde7a1b8185769ce64e8/src/core/lombok/core/TypeLibrary.java#L86-L111 |
130,266 | rzwitserloot/lombok | experimental/src/lombok/javac/disableCheckedExceptions/DisableCheckedExceptionsAgent.java | DisableCheckedExceptionsAgent.init | @Override public void init(ProcessingEnvironment procEnv) {
super.init(procEnv);
String className = procEnv.getClass().getName();
if (className.startsWith("org.eclipse.jdt.")) {
errorToShow = "This version of disableCheckedExceptions is not compatible with eclipse. javac only; sorry.";
procEnv.getMessager()... | java | @Override public void init(ProcessingEnvironment procEnv) {
super.init(procEnv);
String className = procEnv.getClass().getName();
if (className.startsWith("org.eclipse.jdt.")) {
errorToShow = "This version of disableCheckedExceptions is not compatible with eclipse. javac only; sorry.";
procEnv.getMessager()... | [
"@",
"Override",
"public",
"void",
"init",
"(",
"ProcessingEnvironment",
"procEnv",
")",
"{",
"super",
".",
"init",
"(",
"procEnv",
")",
";",
"String",
"className",
"=",
"procEnv",
".",
"getClass",
"(",
")",
".",
"getName",
"(",
")",
";",
"if",
"(",
"c... | Inject an agent if we're on a sun-esque JVM. | [
"Inject",
"an",
"agent",
"if",
"we",
"re",
"on",
"a",
"sun",
"-",
"esque",
"JVM",
"."
] | 75601240760bd81ff95fcde7a1b8185769ce64e8 | https://github.com/rzwitserloot/lombok/blob/75601240760bd81ff95fcde7a1b8185769ce64e8/experimental/src/lombok/javac/disableCheckedExceptions/DisableCheckedExceptionsAgent.java#L50-L62 |
130,267 | rzwitserloot/lombok | experimental/src/lombok/javac/disableCheckedExceptions/DisableCheckedExceptionsAgent.java | DisableCheckedExceptionsAgent.process | @Override public boolean process(Set<? extends TypeElement> annotations, RoundEnvironment roundEnv) {
if (errorToShow != null) {
if (errorToShow != null) {
Set<? extends Element> rootElements = roundEnv.getRootElements();
if (!rootElements.isEmpty()) {
processingEnv.getMessager().printMessage(Kind.WAR... | java | @Override public boolean process(Set<? extends TypeElement> annotations, RoundEnvironment roundEnv) {
if (errorToShow != null) {
if (errorToShow != null) {
Set<? extends Element> rootElements = roundEnv.getRootElements();
if (!rootElements.isEmpty()) {
processingEnv.getMessager().printMessage(Kind.WAR... | [
"@",
"Override",
"public",
"boolean",
"process",
"(",
"Set",
"<",
"?",
"extends",
"TypeElement",
">",
"annotations",
",",
"RoundEnvironment",
"roundEnv",
")",
"{",
"if",
"(",
"errorToShow",
"!=",
"null",
")",
"{",
"if",
"(",
"errorToShow",
"!=",
"null",
")... | Does nothing - we just wanted the init method so we can inject an agent. | [
"Does",
"nothing",
"-",
"we",
"just",
"wanted",
"the",
"init",
"method",
"so",
"we",
"can",
"inject",
"an",
"agent",
"."
] | 75601240760bd81ff95fcde7a1b8185769ce64e8 | https://github.com/rzwitserloot/lombok/blob/75601240760bd81ff95fcde7a1b8185769ce64e8/experimental/src/lombok/javac/disableCheckedExceptions/DisableCheckedExceptionsAgent.java#L65-L76 |
130,268 | rzwitserloot/lombok | src/core/lombok/core/handlers/HandlerUtil.java | HandlerUtil.checkName | public static boolean checkName(String nameSpec, String identifier, LombokNode<?, ?, ?> errorNode) {
if (identifier.isEmpty()) {
errorNode.addError(nameSpec + " cannot be the empty string.");
return false;
}
if (!JavaIdentifiers.isValidJavaIdentifier(identifier)) {
errorNode.addError(nameSpec + " must... | java | public static boolean checkName(String nameSpec, String identifier, LombokNode<?, ?, ?> errorNode) {
if (identifier.isEmpty()) {
errorNode.addError(nameSpec + " cannot be the empty string.");
return false;
}
if (!JavaIdentifiers.isValidJavaIdentifier(identifier)) {
errorNode.addError(nameSpec + " must... | [
"public",
"static",
"boolean",
"checkName",
"(",
"String",
"nameSpec",
",",
"String",
"identifier",
",",
"LombokNode",
"<",
"?",
",",
"?",
",",
"?",
">",
"errorNode",
")",
"{",
"if",
"(",
"identifier",
".",
"isEmpty",
"(",
")",
")",
"{",
"errorNode",
"... | Checks if the given name is a valid identifier.
If it is, this returns {@code true} and does nothing else.
If it isn't, this returns {@code false} and adds an error message to the supplied node. | [
"Checks",
"if",
"the",
"given",
"name",
"is",
"a",
"valid",
"identifier",
"."
] | 75601240760bd81ff95fcde7a1b8185769ce64e8 | https://github.com/rzwitserloot/lombok/blob/75601240760bd81ff95fcde7a1b8185769ce64e8/src/core/lombok/core/handlers/HandlerUtil.java#L310-L322 |
130,269 | rzwitserloot/lombok | src/core/lombok/core/handlers/HandlerUtil.java | HandlerUtil.toGetterName | public static String toGetterName(AST<?, ?, ?> ast, AnnotationValues<Accessors> accessors, CharSequence fieldName, boolean isBoolean) {
return toAccessorName(ast, accessors, fieldName, isBoolean, "is", "get", true);
} | java | public static String toGetterName(AST<?, ?, ?> ast, AnnotationValues<Accessors> accessors, CharSequence fieldName, boolean isBoolean) {
return toAccessorName(ast, accessors, fieldName, isBoolean, "is", "get", true);
} | [
"public",
"static",
"String",
"toGetterName",
"(",
"AST",
"<",
"?",
",",
"?",
",",
"?",
">",
"ast",
",",
"AnnotationValues",
"<",
"Accessors",
">",
"accessors",
",",
"CharSequence",
"fieldName",
",",
"boolean",
"isBoolean",
")",
"{",
"return",
"toAccessorNam... | Generates a getter name from a given field name.
Strategy:
<ul>
<li>Reduce the field's name to its base name by stripping off any prefix (from {@code Accessors}). If the field name does not fit
the prefix list, this method immediately returns {@code null}.</li>
<li>If {@code Accessors} has {@code fluent=true}, then re... | [
"Generates",
"a",
"getter",
"name",
"from",
"a",
"given",
"field",
"name",
"."
] | 75601240760bd81ff95fcde7a1b8185769ce64e8 | https://github.com/rzwitserloot/lombok/blob/75601240760bd81ff95fcde7a1b8185769ce64e8/src/core/lombok/core/handlers/HandlerUtil.java#L472-L474 |
130,270 | rzwitserloot/lombok | src/core/lombok/core/handlers/HandlerUtil.java | HandlerUtil.toWitherName | public static String toWitherName(AST<?, ?, ?> ast, AnnotationValues<Accessors> accessors, CharSequence fieldName, boolean isBoolean) {
return toAccessorName(ast, accessors, fieldName, isBoolean, "with", "with", false);
} | java | public static String toWitherName(AST<?, ?, ?> ast, AnnotationValues<Accessors> accessors, CharSequence fieldName, boolean isBoolean) {
return toAccessorName(ast, accessors, fieldName, isBoolean, "with", "with", false);
} | [
"public",
"static",
"String",
"toWitherName",
"(",
"AST",
"<",
"?",
",",
"?",
",",
"?",
">",
"ast",
",",
"AnnotationValues",
"<",
"Accessors",
">",
"accessors",
",",
"CharSequence",
"fieldName",
",",
"boolean",
"isBoolean",
")",
"{",
"return",
"toAccessorNam... | Generates a wither name from a given field name.
Strategy:
<ul>
<li>Reduce the field's name to its base name by stripping off any prefix (from {@code Accessors}). If the field name does not fit
the prefix list, this method immediately returns {@code null}.</li>
<li>Only if {@code isBoolean} is true: Check if the field... | [
"Generates",
"a",
"wither",
"name",
"from",
"a",
"given",
"field",
"name",
"."
] | 75601240760bd81ff95fcde7a1b8185769ce64e8 | https://github.com/rzwitserloot/lombok/blob/75601240760bd81ff95fcde7a1b8185769ce64e8/src/core/lombok/core/handlers/HandlerUtil.java#L519-L521 |
130,271 | rzwitserloot/lombok | src/core/lombok/core/handlers/HandlerUtil.java | HandlerUtil.toAllGetterNames | public static List<String> toAllGetterNames(AST<?, ?, ?> ast, AnnotationValues<Accessors> accessors, CharSequence fieldName, boolean isBoolean) {
return toAllAccessorNames(ast, accessors, fieldName, isBoolean, "is", "get", true);
} | java | public static List<String> toAllGetterNames(AST<?, ?, ?> ast, AnnotationValues<Accessors> accessors, CharSequence fieldName, boolean isBoolean) {
return toAllAccessorNames(ast, accessors, fieldName, isBoolean, "is", "get", true);
} | [
"public",
"static",
"List",
"<",
"String",
">",
"toAllGetterNames",
"(",
"AST",
"<",
"?",
",",
"?",
",",
"?",
">",
"ast",
",",
"AnnotationValues",
"<",
"Accessors",
">",
"accessors",
",",
"CharSequence",
"fieldName",
",",
"boolean",
"isBoolean",
")",
"{",
... | Returns all names of methods that would represent the getter for a field with the provided name.
For example if {@code isBoolean} is true, then a field named {@code isRunning} would produce:<br />
{@code [isRunning, getRunning, isIsRunning, getIsRunning]}
@param accessors Accessors configuration.
@param fieldName the... | [
"Returns",
"all",
"names",
"of",
"methods",
"that",
"would",
"represent",
"the",
"getter",
"for",
"a",
"field",
"with",
"the",
"provided",
"name",
"."
] | 75601240760bd81ff95fcde7a1b8185769ce64e8 | https://github.com/rzwitserloot/lombok/blob/75601240760bd81ff95fcde7a1b8185769ce64e8/src/core/lombok/core/handlers/HandlerUtil.java#L562-L564 |
130,272 | rzwitserloot/lombok | src/core/lombok/core/handlers/HandlerUtil.java | HandlerUtil.toAllWitherNames | public static List<String> toAllWitherNames(AST<?, ?, ?> ast, AnnotationValues<Accessors> accessors, CharSequence fieldName, boolean isBoolean) {
return toAllAccessorNames(ast, accessors, fieldName, isBoolean, "with", "with", false);
} | java | public static List<String> toAllWitherNames(AST<?, ?, ?> ast, AnnotationValues<Accessors> accessors, CharSequence fieldName, boolean isBoolean) {
return toAllAccessorNames(ast, accessors, fieldName, isBoolean, "with", "with", false);
} | [
"public",
"static",
"List",
"<",
"String",
">",
"toAllWitherNames",
"(",
"AST",
"<",
"?",
",",
"?",
",",
"?",
">",
"ast",
",",
"AnnotationValues",
"<",
"Accessors",
">",
"accessors",
",",
"CharSequence",
"fieldName",
",",
"boolean",
"isBoolean",
")",
"{",
... | Returns all names of methods that would represent the wither for a field with the provided name.
For example if {@code isBoolean} is true, then a field named {@code isRunning} would produce:<br />
{@code [withRunning, withIsRunning]}
@param accessors Accessors configuration.
@param fieldName the name of the field.
@p... | [
"Returns",
"all",
"names",
"of",
"methods",
"that",
"would",
"represent",
"the",
"wither",
"for",
"a",
"field",
"with",
"the",
"provided",
"name",
"."
] | 75601240760bd81ff95fcde7a1b8185769ce64e8 | https://github.com/rzwitserloot/lombok/blob/75601240760bd81ff95fcde7a1b8185769ce64e8/src/core/lombok/core/handlers/HandlerUtil.java#L590-L592 |
130,273 | rzwitserloot/lombok | src/utils/lombok/core/SpiLoadUtil.java | SpiLoadUtil.findServices | public static <C> Iterable<C> findServices(Class<C> target) throws IOException {
return findServices(target, Thread.currentThread().getContextClassLoader());
} | java | public static <C> Iterable<C> findServices(Class<C> target) throws IOException {
return findServices(target, Thread.currentThread().getContextClassLoader());
} | [
"public",
"static",
"<",
"C",
">",
"Iterable",
"<",
"C",
">",
"findServices",
"(",
"Class",
"<",
"C",
">",
"target",
")",
"throws",
"IOException",
"{",
"return",
"findServices",
"(",
"target",
",",
"Thread",
".",
"currentThread",
"(",
")",
".",
"getConte... | Returns an iterator of instances that, at least according to the spi discovery file, are implementations
of the stated class.
Like ServiceLoader, each listed class is turned into an instance by calling the public no-args constructor.
Convenience method that calls the more elaborate {@link #findServices(Class, ClassLo... | [
"Returns",
"an",
"iterator",
"of",
"instances",
"that",
"at",
"least",
"according",
"to",
"the",
"spi",
"discovery",
"file",
"are",
"implementations",
"of",
"the",
"stated",
"class",
"."
] | 75601240760bd81ff95fcde7a1b8185769ce64e8 | https://github.com/rzwitserloot/lombok/blob/75601240760bd81ff95fcde7a1b8185769ce64e8/src/utils/lombok/core/SpiLoadUtil.java#L77-L79 |
130,274 | rzwitserloot/lombok | src/utils/lombok/core/SpiLoadUtil.java | SpiLoadUtil.findServices | public static <C> Iterable<C> findServices(final Class<C> target, ClassLoader loader) throws IOException {
if (loader == null) loader = ClassLoader.getSystemClassLoader();
Enumeration<URL> resources = loader.getResources("META-INF/services/" + target.getName());
final Set<String> entries = new LinkedHashSet<Strin... | java | public static <C> Iterable<C> findServices(final Class<C> target, ClassLoader loader) throws IOException {
if (loader == null) loader = ClassLoader.getSystemClassLoader();
Enumeration<URL> resources = loader.getResources("META-INF/services/" + target.getName());
final Set<String> entries = new LinkedHashSet<Strin... | [
"public",
"static",
"<",
"C",
">",
"Iterable",
"<",
"C",
">",
"findServices",
"(",
"final",
"Class",
"<",
"C",
">",
"target",
",",
"ClassLoader",
"loader",
")",
"throws",
"IOException",
"{",
"if",
"(",
"loader",
"==",
"null",
")",
"loader",
"=",
"Class... | Returns an iterator of class objects that, at least according to the spi discovery file, are implementations
of the stated class.
Like ServiceLoader, each listed class is turned into an instance by calling the public no-args constructor.
@param target class to find implementations for.
@param loader The classloader o... | [
"Returns",
"an",
"iterator",
"of",
"class",
"objects",
"that",
"at",
"least",
"according",
"to",
"the",
"spi",
"discovery",
"file",
"are",
"implementations",
"of",
"the",
"stated",
"class",
"."
] | 75601240760bd81ff95fcde7a1b8185769ce64e8 | https://github.com/rzwitserloot/lombok/blob/75601240760bd81ff95fcde7a1b8185769ce64e8/src/utils/lombok/core/SpiLoadUtil.java#L91-L124 |
130,275 | rzwitserloot/lombok | src/core/lombok/core/AST.java | AST.buildWithField | protected Collection<L> buildWithField(Class<L> nodeType, N statement, FieldAccess fa) {
List<L> list = new ArrayList<L>();
buildWithField0(nodeType, statement, fa, list);
return list;
} | java | protected Collection<L> buildWithField(Class<L> nodeType, N statement, FieldAccess fa) {
List<L> list = new ArrayList<L>();
buildWithField0(nodeType, statement, fa, list);
return list;
} | [
"protected",
"Collection",
"<",
"L",
">",
"buildWithField",
"(",
"Class",
"<",
"L",
">",
"nodeType",
",",
"N",
"statement",
",",
"FieldAccess",
"fa",
")",
"{",
"List",
"<",
"L",
">",
"list",
"=",
"new",
"ArrayList",
"<",
"L",
">",
"(",
")",
";",
"b... | buildTree implementation that uses reflection to find all child nodes by way of inspecting
the fields. | [
"buildTree",
"implementation",
"that",
"uses",
"reflection",
"to",
"find",
"all",
"child",
"nodes",
"by",
"way",
"of",
"inspecting",
"the",
"fields",
"."
] | 75601240760bd81ff95fcde7a1b8185769ce64e8 | https://github.com/rzwitserloot/lombok/blob/75601240760bd81ff95fcde7a1b8185769ce64e8/src/core/lombok/core/AST.java#L290-L294 |
130,276 | rzwitserloot/lombok | src/core/lombok/core/AST.java | AST.replaceStatementInNode | protected boolean replaceStatementInNode(N statement, N oldN, N newN) {
for (FieldAccess fa : fieldsOf(statement.getClass())) {
if (replaceStatementInField(fa, statement, oldN, newN)) return true;
}
return false;
} | java | protected boolean replaceStatementInNode(N statement, N oldN, N newN) {
for (FieldAccess fa : fieldsOf(statement.getClass())) {
if (replaceStatementInField(fa, statement, oldN, newN)) return true;
}
return false;
} | [
"protected",
"boolean",
"replaceStatementInNode",
"(",
"N",
"statement",
",",
"N",
"oldN",
",",
"N",
"newN",
")",
"{",
"for",
"(",
"FieldAccess",
"fa",
":",
"fieldsOf",
"(",
"statement",
".",
"getClass",
"(",
")",
")",
")",
"{",
"if",
"(",
"replaceStatem... | Uses reflection to find the given direct child on the given statement, and replace it with a new child. | [
"Uses",
"reflection",
"to",
"find",
"the",
"given",
"direct",
"child",
"on",
"the",
"given",
"statement",
"and",
"replace",
"it",
"with",
"a",
"new",
"child",
"."
] | 75601240760bd81ff95fcde7a1b8185769ce64e8 | https://github.com/rzwitserloot/lombok/blob/75601240760bd81ff95fcde7a1b8185769ce64e8/src/core/lombok/core/AST.java#L299-L305 |
130,277 | rzwitserloot/lombok | src/core/lombok/core/AST.java | AST.setElementInASTCollection | @SuppressWarnings({"rawtypes", "unchecked"})
protected void setElementInASTCollection(Field field, Object fieldRef, List<Collection<?>> chain, Collection<?> collection, int idx, N newN) throws IllegalAccessException {
if (collection instanceof List<?>) {
((List) collection).set(idx, newN);
}
} | java | @SuppressWarnings({"rawtypes", "unchecked"})
protected void setElementInASTCollection(Field field, Object fieldRef, List<Collection<?>> chain, Collection<?> collection, int idx, N newN) throws IllegalAccessException {
if (collection instanceof List<?>) {
((List) collection).set(idx, newN);
}
} | [
"@",
"SuppressWarnings",
"(",
"{",
"\"rawtypes\"",
",",
"\"unchecked\"",
"}",
")",
"protected",
"void",
"setElementInASTCollection",
"(",
"Field",
"field",
",",
"Object",
"fieldRef",
",",
"List",
"<",
"Collection",
"<",
"?",
">",
">",
"chain",
",",
"Collection... | Override if your AST collection does not support the set method. Javac's for example, does not.
@param field The field that contains the array or list of AST nodes.
@param fieldRef The object that you can supply to the field's {@code get} method.
@param chain If the collection is immutable, you need to update the poin... | [
"Override",
"if",
"your",
"AST",
"collection",
"does",
"not",
"support",
"the",
"set",
"method",
".",
"Javac",
"s",
"for",
"example",
"does",
"not",
"."
] | 75601240760bd81ff95fcde7a1b8185769ce64e8 | https://github.com/rzwitserloot/lombok/blob/75601240760bd81ff95fcde7a1b8185769ce64e8/src/core/lombok/core/AST.java#L363-L368 |
130,278 | rzwitserloot/lombok | src/installer/lombok/installer/eclipse/EclipseProductLocationProvider.java | EclipseProductLocationProvider.findIdes | @Override
public void findIdes(List<IdeLocation> locations, List<CorruptedIdeLocationException> problems) {
switch (OsUtils.getOS()) {
case WINDOWS:
new WindowsFinder().findEclipse(locations, problems);
break;
case MAC_OS_X:
new MacFinder().findEclipse(locations, problems);
break;
default:
case U... | java | @Override
public void findIdes(List<IdeLocation> locations, List<CorruptedIdeLocationException> problems) {
switch (OsUtils.getOS()) {
case WINDOWS:
new WindowsFinder().findEclipse(locations, problems);
break;
case MAC_OS_X:
new MacFinder().findEclipse(locations, problems);
break;
default:
case U... | [
"@",
"Override",
"public",
"void",
"findIdes",
"(",
"List",
"<",
"IdeLocation",
">",
"locations",
",",
"List",
"<",
"CorruptedIdeLocationException",
">",
"problems",
")",
"{",
"switch",
"(",
"OsUtils",
".",
"getOS",
"(",
")",
")",
"{",
"case",
"WINDOWS",
"... | Calls the OS-dependent 'find Eclipse' routine. If the local OS doesn't have a routine written for it,
null is returned.
@param locations
List of valid eclipse locations - provide an empty list; this
method will fill it.
@param problems
List of eclipse locations that seem to contain half-baked
eclipses that can't be in... | [
"Calls",
"the",
"OS",
"-",
"dependent",
"find",
"Eclipse",
"routine",
".",
"If",
"the",
"local",
"OS",
"doesn",
"t",
"have",
"a",
"routine",
"written",
"for",
"it",
"null",
"is",
"returned",
"."
] | 75601240760bd81ff95fcde7a1b8185769ce64e8 | https://github.com/rzwitserloot/lombok/blob/75601240760bd81ff95fcde7a1b8185769ce64e8/src/installer/lombok/installer/eclipse/EclipseProductLocationProvider.java#L164-L178 |
130,279 | rzwitserloot/lombok | src/installer/lombok/installer/eclipse/EclipseProductLocationProvider.java | EclipseProductLocationProvider.getSourceDirsOnWindowsWithDriveLetters | private List<String> getSourceDirsOnWindowsWithDriveLetters() {
List<String> driveLetters = asList("C");
try {
driveLetters = OsUtils.getDrivesOnWindows();
} catch (Throwable ignore) {
ignore.printStackTrace();
}
List<String> sourceDirs = new ArrayList<String>();
for (String letter : driveLetters) {
... | java | private List<String> getSourceDirsOnWindowsWithDriveLetters() {
List<String> driveLetters = asList("C");
try {
driveLetters = OsUtils.getDrivesOnWindows();
} catch (Throwable ignore) {
ignore.printStackTrace();
}
List<String> sourceDirs = new ArrayList<String>();
for (String letter : driveLetters) {
... | [
"private",
"List",
"<",
"String",
">",
"getSourceDirsOnWindowsWithDriveLetters",
"(",
")",
"{",
"List",
"<",
"String",
">",
"driveLetters",
"=",
"asList",
"(",
"\"C\"",
")",
";",
"try",
"{",
"driveLetters",
"=",
"OsUtils",
".",
"getDrivesOnWindows",
"(",
")",
... | Returns a list of paths of Eclipse installations.
The search process works by scanning for each 'source dir' for either an eclipse installation or a folder containing the text returned
by getDirName(). If such a folder is found, this process is applied recursively. On windows, this process is run on each drive letter
... | [
"Returns",
"a",
"list",
"of",
"paths",
"of",
"Eclipse",
"installations",
"."
] | 75601240760bd81ff95fcde7a1b8185769ce64e8 | https://github.com/rzwitserloot/lombok/blob/75601240760bd81ff95fcde7a1b8185769ce64e8/src/installer/lombok/installer/eclipse/EclipseProductLocationProvider.java#L222-L242 |
130,280 | rzwitserloot/lombok | src/utils/lombok/javac/TreeMirrorMaker.java | TreeMirrorMaker.visitLabeledStatement | @Override public JCTree visitLabeledStatement(LabeledStatementTree node, Void p) {
return node.getStatement().accept(this, p);
} | java | @Override public JCTree visitLabeledStatement(LabeledStatementTree node, Void p) {
return node.getStatement().accept(this, p);
} | [
"@",
"Override",
"public",
"JCTree",
"visitLabeledStatement",
"(",
"LabeledStatementTree",
"node",
",",
"Void",
"p",
")",
"{",
"return",
"node",
".",
"getStatement",
"(",
")",
".",
"accept",
"(",
"this",
",",
"p",
")",
";",
"}"
] | This and visitVariable is rather hacky but we're working around evident bugs or at least inconsistencies in javac. | [
"This",
"and",
"visitVariable",
"is",
"rather",
"hacky",
"but",
"we",
"re",
"working",
"around",
"evident",
"bugs",
"or",
"at",
"least",
"inconsistencies",
"in",
"javac",
"."
] | 75601240760bd81ff95fcde7a1b8185769ce64e8 | https://github.com/rzwitserloot/lombok/blob/75601240760bd81ff95fcde7a1b8185769ce64e8/src/utils/lombok/javac/TreeMirrorMaker.java#L120-L122 |
130,281 | rzwitserloot/lombok | src/core/lombok/eclipse/EclipseNode.java | EclipseNode.addError | public void addError(String message, int sourceStart, int sourceEnd) {
ast.addProblem(ast.new ParseProblem(false, message, sourceStart, sourceEnd));
} | java | public void addError(String message, int sourceStart, int sourceEnd) {
ast.addProblem(ast.new ParseProblem(false, message, sourceStart, sourceEnd));
} | [
"public",
"void",
"addError",
"(",
"String",
"message",
",",
"int",
"sourceStart",
",",
"int",
"sourceEnd",
")",
"{",
"ast",
".",
"addProblem",
"(",
"ast",
".",
"new",
"ParseProblem",
"(",
"false",
",",
"message",
",",
"sourceStart",
",",
"sourceEnd",
")",... | Generate a compiler error that shows the wavy underline from-to the stated character positions. | [
"Generate",
"a",
"compiler",
"error",
"that",
"shows",
"the",
"wavy",
"underline",
"from",
"-",
"to",
"the",
"stated",
"character",
"positions",
"."
] | 75601240760bd81ff95fcde7a1b8185769ce64e8 | https://github.com/rzwitserloot/lombok/blob/75601240760bd81ff95fcde7a1b8185769ce64e8/src/core/lombok/eclipse/EclipseNode.java#L173-L175 |
130,282 | rzwitserloot/lombok | src/core/lombok/eclipse/EclipseNode.java | EclipseNode.addWarning | public void addWarning(String message, int sourceStart, int sourceEnd) {
ast.addProblem(ast.new ParseProblem(true, message, sourceStart, sourceEnd));
} | java | public void addWarning(String message, int sourceStart, int sourceEnd) {
ast.addProblem(ast.new ParseProblem(true, message, sourceStart, sourceEnd));
} | [
"public",
"void",
"addWarning",
"(",
"String",
"message",
",",
"int",
"sourceStart",
",",
"int",
"sourceEnd",
")",
"{",
"ast",
".",
"addProblem",
"(",
"ast",
".",
"new",
"ParseProblem",
"(",
"true",
",",
"message",
",",
"sourceStart",
",",
"sourceEnd",
")"... | Generate a compiler warning that shows the wavy underline from-to the stated character positions. | [
"Generate",
"a",
"compiler",
"warning",
"that",
"shows",
"the",
"wavy",
"underline",
"from",
"-",
"to",
"the",
"stated",
"character",
"positions",
"."
] | 75601240760bd81ff95fcde7a1b8185769ce64e8 | https://github.com/rzwitserloot/lombok/blob/75601240760bd81ff95fcde7a1b8185769ce64e8/src/core/lombok/eclipse/EclipseNode.java#L183-L185 |
130,283 | rzwitserloot/lombok | src/core/lombok/core/Version.java | Version.main | public static void main(String[] args) {
if (args.length > 0) {
System.out.printf("%s\n", getFullVersion());
} else {
System.out.println(VERSION);
}
} | java | public static void main(String[] args) {
if (args.length > 0) {
System.out.printf("%s\n", getFullVersion());
} else {
System.out.println(VERSION);
}
} | [
"public",
"static",
"void",
"main",
"(",
"String",
"[",
"]",
"args",
")",
"{",
"if",
"(",
"args",
".",
"length",
">",
"0",
")",
"{",
"System",
".",
"out",
".",
"printf",
"(",
"\"%s\\n\"",
",",
"getFullVersion",
"(",
")",
")",
";",
"}",
"else",
"{... | Prints the version followed by a newline, and exits. | [
"Prints",
"the",
"version",
"followed",
"by",
"a",
"newline",
"and",
"exits",
"."
] | 75601240760bd81ff95fcde7a1b8185769ce64e8 | https://github.com/rzwitserloot/lombok/blob/75601240760bd81ff95fcde7a1b8185769ce64e8/src/core/lombok/core/Version.java#L51-L57 |
130,284 | rzwitserloot/lombok | src/core/lombok/javac/handlers/HandleEqualsAndHashCode.java | HandleEqualsAndHashCode.longToIntForHashCode | public JCExpression longToIntForHashCode(JavacTreeMaker maker, JCExpression ref1, JCExpression ref2) {
/* (int) (ref >>> 32 ^ ref) */
JCExpression shift = maker.Binary(CTC_UNSIGNED_SHIFT_RIGHT, ref1, maker.Literal(32));
JCExpression xorBits = maker.Binary(CTC_BITXOR, shift, ref2);
return maker.TypeCast(maker.Ty... | java | public JCExpression longToIntForHashCode(JavacTreeMaker maker, JCExpression ref1, JCExpression ref2) {
/* (int) (ref >>> 32 ^ ref) */
JCExpression shift = maker.Binary(CTC_UNSIGNED_SHIFT_RIGHT, ref1, maker.Literal(32));
JCExpression xorBits = maker.Binary(CTC_BITXOR, shift, ref2);
return maker.TypeCast(maker.Ty... | [
"public",
"JCExpression",
"longToIntForHashCode",
"(",
"JavacTreeMaker",
"maker",
",",
"JCExpression",
"ref1",
",",
"JCExpression",
"ref2",
")",
"{",
"/* (int) (ref >>> 32 ^ ref) */",
"JCExpression",
"shift",
"=",
"maker",
".",
"Binary",
"(",
"CTC_UNSIGNED_SHIFT_RIGHT",
... | The 2 references must be clones of each other. | [
"The",
"2",
"references",
"must",
"be",
"clones",
"of",
"each",
"other",
"."
] | 75601240760bd81ff95fcde7a1b8185769ce64e8 | https://github.com/rzwitserloot/lombok/blob/75601240760bd81ff95fcde7a1b8185769ce64e8/src/core/lombok/javac/handlers/HandleEqualsAndHashCode.java#L322-L327 |
130,285 | mrniko/netty-socketio | src/main/java/com/corundumstudio/socketio/MultiTypeArgs.java | MultiTypeArgs.get | public <T> T get(int index) {
if (size() <= index) {
return null;
}
return (T) args.get(index);
} | java | public <T> T get(int index) {
if (size() <= index) {
return null;
}
return (T) args.get(index);
} | [
"public",
"<",
"T",
">",
"T",
"get",
"(",
"int",
"index",
")",
"{",
"if",
"(",
"size",
"(",
")",
"<=",
"index",
")",
"{",
"return",
"null",
";",
"}",
"return",
"(",
"T",
")",
"args",
".",
"get",
"(",
"index",
")",
";",
"}"
] | "index out of bounds"-safe method for getting elements
@param <T> type of argument
@param index to get
@return argument | [
"index",
"out",
"of",
"bounds",
"-",
"safe",
"method",
"for",
"getting",
"elements"
] | ea1787f3369f94f527002bd9737fb278750933e2 | https://github.com/mrniko/netty-socketio/blob/ea1787f3369f94f527002bd9737fb278750933e2/src/main/java/com/corundumstudio/socketio/MultiTypeArgs.java#L57-L62 |
130,286 | mrniko/netty-socketio | src/main/java/com/corundumstudio/socketio/protocol/PacketDecoder.java | PacketDecoder.readLong | private long readLong(ByteBuf chars, int length) {
long result = 0;
for (int i = chars.readerIndex(); i < chars.readerIndex() + length; i++) {
int digit = ((int)chars.getByte(i) & 0xF);
for (int j = 0; j < chars.readerIndex() + length-1-i; j++) {
digit *= 10;
... | java | private long readLong(ByteBuf chars, int length) {
long result = 0;
for (int i = chars.readerIndex(); i < chars.readerIndex() + length; i++) {
int digit = ((int)chars.getByte(i) & 0xF);
for (int j = 0; j < chars.readerIndex() + length-1-i; j++) {
digit *= 10;
... | [
"private",
"long",
"readLong",
"(",
"ByteBuf",
"chars",
",",
"int",
"length",
")",
"{",
"long",
"result",
"=",
"0",
";",
"for",
"(",
"int",
"i",
"=",
"chars",
".",
"readerIndex",
"(",
")",
";",
"i",
"<",
"chars",
".",
"readerIndex",
"(",
")",
"+",
... | fastest way to parse chars to int | [
"fastest",
"way",
"to",
"parse",
"chars",
"to",
"int"
] | ea1787f3369f94f527002bd9737fb278750933e2 | https://github.com/mrniko/netty-socketio/blob/ea1787f3369f94f527002bd9737fb278750933e2/src/main/java/com/corundumstudio/socketio/protocol/PacketDecoder.java#L71-L82 |
130,287 | mrniko/netty-socketio | src/main/java/com/corundumstudio/socketio/SocketIOServer.java | SocketIOServer.getClient | public SocketIOClient getClient(UUID uuid) {
return namespacesHub.get(Namespace.DEFAULT_NAME).getClient(uuid);
} | java | public SocketIOClient getClient(UUID uuid) {
return namespacesHub.get(Namespace.DEFAULT_NAME).getClient(uuid);
} | [
"public",
"SocketIOClient",
"getClient",
"(",
"UUID",
"uuid",
")",
"{",
"return",
"namespacesHub",
".",
"get",
"(",
"Namespace",
".",
"DEFAULT_NAME",
")",
".",
"getClient",
"(",
"uuid",
")",
";",
"}"
] | Get client by uuid from default namespace
@param uuid - id of client
@return client | [
"Get",
"client",
"by",
"uuid",
"from",
"default",
"namespace"
] | ea1787f3369f94f527002bd9737fb278750933e2 | https://github.com/mrniko/netty-socketio/blob/ea1787f3369f94f527002bd9737fb278750933e2/src/main/java/com/corundumstudio/socketio/SocketIOServer.java#L86-L88 |
130,288 | mrniko/netty-socketio | src/main/java/com/corundumstudio/socketio/SocketIOServer.java | SocketIOServer.startAsync | public Future<Void> startAsync() {
log.info("Session store / pubsub factory used: {}", configCopy.getStoreFactory());
initGroups();
pipelineFactory.start(configCopy, namespacesHub);
Class<? extends ServerChannel> channelClass = NioServerSocketChannel.class;
if (configCopy.isUse... | java | public Future<Void> startAsync() {
log.info("Session store / pubsub factory used: {}", configCopy.getStoreFactory());
initGroups();
pipelineFactory.start(configCopy, namespacesHub);
Class<? extends ServerChannel> channelClass = NioServerSocketChannel.class;
if (configCopy.isUse... | [
"public",
"Future",
"<",
"Void",
">",
"startAsync",
"(",
")",
"{",
"log",
".",
"info",
"(",
"\"Session store / pubsub factory used: {}\"",
",",
"configCopy",
".",
"getStoreFactory",
"(",
")",
")",
";",
"initGroups",
"(",
")",
";",
"pipelineFactory",
".",
"star... | Start server asynchronously
@return void | [
"Start",
"server",
"asynchronously"
] | ea1787f3369f94f527002bd9737fb278750933e2 | https://github.com/mrniko/netty-socketio/blob/ea1787f3369f94f527002bd9737fb278750933e2/src/main/java/com/corundumstudio/socketio/SocketIOServer.java#L127-L159 |
130,289 | mrniko/netty-socketio | src/main/java/com/corundumstudio/socketio/SocketIOChannelInitializer.java | SocketIOChannelInitializer.addSslHandler | protected void addSslHandler(ChannelPipeline pipeline) {
if (sslContext != null) {
SSLEngine engine = sslContext.createSSLEngine();
engine.setUseClientMode(false);
pipeline.addLast(SSL_HANDLER, new SslHandler(engine));
}
} | java | protected void addSslHandler(ChannelPipeline pipeline) {
if (sslContext != null) {
SSLEngine engine = sslContext.createSSLEngine();
engine.setUseClientMode(false);
pipeline.addLast(SSL_HANDLER, new SslHandler(engine));
}
} | [
"protected",
"void",
"addSslHandler",
"(",
"ChannelPipeline",
"pipeline",
")",
"{",
"if",
"(",
"sslContext",
"!=",
"null",
")",
"{",
"SSLEngine",
"engine",
"=",
"sslContext",
".",
"createSSLEngine",
"(",
")",
";",
"engine",
".",
"setUseClientMode",
"(",
"false... | Adds the ssl handler
@param pipeline - channel pipeline | [
"Adds",
"the",
"ssl",
"handler"
] | ea1787f3369f94f527002bd9737fb278750933e2 | https://github.com/mrniko/netty-socketio/blob/ea1787f3369f94f527002bd9737fb278750933e2/src/main/java/com/corundumstudio/socketio/SocketIOChannelInitializer.java#L154-L160 |
130,290 | mrniko/netty-socketio | src/main/java/com/corundumstudio/socketio/SocketIOChannelInitializer.java | SocketIOChannelInitializer.addSocketioHandlers | protected void addSocketioHandlers(ChannelPipeline pipeline) {
pipeline.addLast(HTTP_REQUEST_DECODER, new HttpRequestDecoder());
pipeline.addLast(HTTP_AGGREGATOR, new HttpObjectAggregator(configuration.getMaxHttpContentLength()) {
@Override
protected Object newContinueResponse(Ht... | java | protected void addSocketioHandlers(ChannelPipeline pipeline) {
pipeline.addLast(HTTP_REQUEST_DECODER, new HttpRequestDecoder());
pipeline.addLast(HTTP_AGGREGATOR, new HttpObjectAggregator(configuration.getMaxHttpContentLength()) {
@Override
protected Object newContinueResponse(Ht... | [
"protected",
"void",
"addSocketioHandlers",
"(",
"ChannelPipeline",
"pipeline",
")",
"{",
"pipeline",
".",
"addLast",
"(",
"HTTP_REQUEST_DECODER",
",",
"new",
"HttpRequestDecoder",
"(",
")",
")",
";",
"pipeline",
".",
"addLast",
"(",
"HTTP_AGGREGATOR",
",",
"new",... | Adds the socketio channel handlers
@param pipeline - channel pipeline | [
"Adds",
"the",
"socketio",
"channel",
"handlers"
] | ea1787f3369f94f527002bd9737fb278750933e2 | https://github.com/mrniko/netty-socketio/blob/ea1787f3369f94f527002bd9737fb278750933e2/src/main/java/com/corundumstudio/socketio/SocketIOChannelInitializer.java#L167-L196 |
130,291 | mrniko/netty-socketio | src/main/java/com/corundumstudio/socketio/Configuration.java | Configuration.setTransports | public void setTransports(Transport ... transports) {
if (transports.length == 0) {
throw new IllegalArgumentException("Transports list can't be empty");
}
this.transports = Arrays.asList(transports);
} | java | public void setTransports(Transport ... transports) {
if (transports.length == 0) {
throw new IllegalArgumentException("Transports list can't be empty");
}
this.transports = Arrays.asList(transports);
} | [
"public",
"void",
"setTransports",
"(",
"Transport",
"...",
"transports",
")",
"{",
"if",
"(",
"transports",
".",
"length",
"==",
"0",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"Transports list can't be empty\"",
")",
";",
"}",
"this",
".",
... | Transports supported by server
@param transports - list of transports | [
"Transports",
"supported",
"by",
"server"
] | ea1787f3369f94f527002bd9737fb278750933e2 | https://github.com/mrniko/netty-socketio/blob/ea1787f3369f94f527002bd9737fb278750933e2/src/main/java/com/corundumstudio/socketio/Configuration.java#L315-L320 |
130,292 | vipshop/vjtools | vjkit/src/main/java/com/vip/vjtools/vjkit/collection/type/primitive/LongObjectHashMap.java | LongObjectHashMap.growSize | private void growSize() {
size++;
if (size > maxSize) {
if (keys.length == Integer.MAX_VALUE) {
throw new IllegalStateException("Max capacity reached at size=" + size);
}
// Double the capacity.
rehash(keys.length << 1);
}
} | java | private void growSize() {
size++;
if (size > maxSize) {
if (keys.length == Integer.MAX_VALUE) {
throw new IllegalStateException("Max capacity reached at size=" + size);
}
// Double the capacity.
rehash(keys.length << 1);
}
} | [
"private",
"void",
"growSize",
"(",
")",
"{",
"size",
"++",
";",
"if",
"(",
"size",
">",
"maxSize",
")",
"{",
"if",
"(",
"keys",
".",
"length",
"==",
"Integer",
".",
"MAX_VALUE",
")",
"{",
"throw",
"new",
"IllegalStateException",
"(",
"\"Max capacity rea... | Grows the map size after an insertion. If necessary, performs a rehash of the map. | [
"Grows",
"the",
"map",
"size",
"after",
"an",
"insertion",
".",
"If",
"necessary",
"performs",
"a",
"rehash",
"of",
"the",
"map",
"."
] | 60c743da35913d72f37f2d79afa90ad2bf73cb89 | https://github.com/vipshop/vjtools/blob/60c743da35913d72f37f2d79afa90ad2bf73cb89/vjkit/src/main/java/com/vip/vjtools/vjkit/collection/type/primitive/LongObjectHashMap.java#L385-L396 |
130,293 | vipshop/vjtools | vjkit/src/main/java/com/vip/vjtools/vjkit/collection/type/primitive/LongObjectHashMap.java | LongObjectHashMap.removeAt | private boolean removeAt(final int index) {
--size;
// Clearing the key is not strictly necessary (for GC like in a regular collection),
// but recommended for security. The memory location is still fresh in the cache anyway.
keys[index] = 0;
values[index] = null;
// In the interval from index to the next ... | java | private boolean removeAt(final int index) {
--size;
// Clearing the key is not strictly necessary (for GC like in a regular collection),
// but recommended for security. The memory location is still fresh in the cache anyway.
keys[index] = 0;
values[index] = null;
// In the interval from index to the next ... | [
"private",
"boolean",
"removeAt",
"(",
"final",
"int",
"index",
")",
"{",
"--",
"size",
";",
"// Clearing the key is not strictly necessary (for GC like in a regular collection),",
"// but recommended for security. The memory location is still fresh in the cache anyway.",
"keys",
"[",
... | Removes entry at the given index position. Also performs opportunistic, incremental rehashing if necessary to not
break conflict chains.
@param index the index position of the element to remove.
@return {@code true} if the next item was moved back. {@code false} otherwise. | [
"Removes",
"entry",
"at",
"the",
"given",
"index",
"position",
".",
"Also",
"performs",
"opportunistic",
"incremental",
"rehashing",
"if",
"necessary",
"to",
"not",
"break",
"conflict",
"chains",
"."
] | 60c743da35913d72f37f2d79afa90ad2bf73cb89 | https://github.com/vipshop/vjtools/blob/60c743da35913d72f37f2d79afa90ad2bf73cb89/vjkit/src/main/java/com/vip/vjtools/vjkit/collection/type/primitive/LongObjectHashMap.java#L405-L433 |
130,294 | vipshop/vjtools | vjkit/src/main/java/com/vip/vjtools/vjkit/collection/type/primitive/LongObjectHashMap.java | LongObjectHashMap.rehash | private void rehash(int newCapacity) {
long[] oldKeys = keys;
V[] oldVals = values;
keys = new long[newCapacity];
@SuppressWarnings({ "unchecked", "SuspiciousArrayCast" })
V[] temp = (V[]) new Object[newCapacity];
values = temp;
maxSize = calcMaxSize(newCapacity);
mask = newCapacity - 1;
// Insert ... | java | private void rehash(int newCapacity) {
long[] oldKeys = keys;
V[] oldVals = values;
keys = new long[newCapacity];
@SuppressWarnings({ "unchecked", "SuspiciousArrayCast" })
V[] temp = (V[]) new Object[newCapacity];
values = temp;
maxSize = calcMaxSize(newCapacity);
mask = newCapacity - 1;
// Insert ... | [
"private",
"void",
"rehash",
"(",
"int",
"newCapacity",
")",
"{",
"long",
"[",
"]",
"oldKeys",
"=",
"keys",
";",
"V",
"[",
"]",
"oldVals",
"=",
"values",
";",
"keys",
"=",
"new",
"long",
"[",
"newCapacity",
"]",
";",
"@",
"SuppressWarnings",
"(",
"{"... | Rehashes the map for the given capacity.
@param newCapacity the new capacity for the map. | [
"Rehashes",
"the",
"map",
"for",
"the",
"given",
"capacity",
"."
] | 60c743da35913d72f37f2d79afa90ad2bf73cb89 | https://github.com/vipshop/vjtools/blob/60c743da35913d72f37f2d79afa90ad2bf73cb89/vjkit/src/main/java/com/vip/vjtools/vjkit/collection/type/primitive/LongObjectHashMap.java#L449-L482 |
130,295 | vipshop/vjtools | vjtop/src/main/java/com/vip/vjtools/vjtop/util/Utils.java | Utils.sortAndFilterThreadIdsByValue | public static long[] sortAndFilterThreadIdsByValue(LongObjectMap map, int threadLimit) {
int max = Math.min(threadLimit, map.size());
List<Map.Entry> list = new LinkedList(map.entrySet());
Collections.sort(list, new Comparator() {
@Override
public int compare(Object o1, Object o2) {
return ((Comparable)... | java | public static long[] sortAndFilterThreadIdsByValue(LongObjectMap map, int threadLimit) {
int max = Math.min(threadLimit, map.size());
List<Map.Entry> list = new LinkedList(map.entrySet());
Collections.sort(list, new Comparator() {
@Override
public int compare(Object o1, Object o2) {
return ((Comparable)... | [
"public",
"static",
"long",
"[",
"]",
"sortAndFilterThreadIdsByValue",
"(",
"LongObjectMap",
"map",
",",
"int",
"threadLimit",
")",
"{",
"int",
"max",
"=",
"Math",
".",
"min",
"(",
"threadLimit",
",",
"map",
".",
"size",
"(",
")",
")",
";",
"List",
"<",
... | Sorts a Map by its values, using natural ordering. | [
"Sorts",
"a",
"Map",
"by",
"its",
"values",
"using",
"natural",
"ordering",
"."
] | 60c743da35913d72f37f2d79afa90ad2bf73cb89 | https://github.com/vipshop/vjtools/blob/60c743da35913d72f37f2d79afa90ad2bf73cb89/vjtop/src/main/java/com/vip/vjtools/vjtop/util/Utils.java#L16-L36 |
130,296 | vipshop/vjtools | vjtop/src/main/java/com/vip/vjtools/vjtop/util/Utils.java | Utils.calcLoad | public static double calcLoad(Long deltaCpuTime, long deltaUptime, long factor) {
if (deltaCpuTime == null || deltaCpuTime <= 0 || deltaUptime == 0) {
return 0.0;
}
return deltaCpuTime * 100d / factor / deltaUptime;
} | java | public static double calcLoad(Long deltaCpuTime, long deltaUptime, long factor) {
if (deltaCpuTime == null || deltaCpuTime <= 0 || deltaUptime == 0) {
return 0.0;
}
return deltaCpuTime * 100d / factor / deltaUptime;
} | [
"public",
"static",
"double",
"calcLoad",
"(",
"Long",
"deltaCpuTime",
",",
"long",
"deltaUptime",
",",
"long",
"factor",
")",
"{",
"if",
"(",
"deltaCpuTime",
"==",
"null",
"||",
"deltaCpuTime",
"<=",
"0",
"||",
"deltaUptime",
"==",
"0",
")",
"{",
"return"... | calculates a "load", given on two deltas | [
"calculates",
"a",
"load",
"given",
"on",
"two",
"deltas"
] | 60c743da35913d72f37f2d79afa90ad2bf73cb89 | https://github.com/vipshop/vjtools/blob/60c743da35913d72f37f2d79afa90ad2bf73cb89/vjtop/src/main/java/com/vip/vjtools/vjtop/util/Utils.java#L51-L56 |
130,297 | vipshop/vjtools | vjkit/src/main/java/com/vip/vjtools/vjkit/concurrent/jsr166e/Striped64.java | Striped64.internalReset | final void internalReset(long initialValue) {
Cell[] as = cells;
base = initialValue;
if (as != null) {
int n = as.length;
for (int i = 0; i < n; ++i) {
Cell a = as[i];
if (a != null) a.value = initialValue;
}
}
} | java | final void internalReset(long initialValue) {
Cell[] as = cells;
base = initialValue;
if (as != null) {
int n = as.length;
for (int i = 0; i < n; ++i) {
Cell a = as[i];
if (a != null) a.value = initialValue;
}
}
} | [
"final",
"void",
"internalReset",
"(",
"long",
"initialValue",
")",
"{",
"Cell",
"[",
"]",
"as",
"=",
"cells",
";",
"base",
"=",
"initialValue",
";",
"if",
"(",
"as",
"!=",
"null",
")",
"{",
"int",
"n",
"=",
"as",
".",
"length",
";",
"for",
"(",
... | Sets base and all cells to the given value. | [
"Sets",
"base",
"and",
"all",
"cells",
"to",
"the",
"given",
"value",
"."
] | 60c743da35913d72f37f2d79afa90ad2bf73cb89 | https://github.com/vipshop/vjtools/blob/60c743da35913d72f37f2d79afa90ad2bf73cb89/vjkit/src/main/java/com/vip/vjtools/vjkit/concurrent/jsr166e/Striped64.java#L252-L262 |
130,298 | vipshop/vjtools | vjkit/src/main/java/com/vip/vjtools/vjkit/mapper/XmlMapper.java | XmlMapper.toXml | public static String toXml(Object root) {
Class clazz = ClassUtil.unwrapCglib(root);
return toXml(root, clazz, null);
} | java | public static String toXml(Object root) {
Class clazz = ClassUtil.unwrapCglib(root);
return toXml(root, clazz, null);
} | [
"public",
"static",
"String",
"toXml",
"(",
"Object",
"root",
")",
"{",
"Class",
"clazz",
"=",
"ClassUtil",
".",
"unwrapCglib",
"(",
"root",
")",
";",
"return",
"toXml",
"(",
"root",
",",
"clazz",
",",
"null",
")",
";",
"}"
] | Java Object->Xml without encoding. | [
"Java",
"Object",
"-",
">",
"Xml",
"without",
"encoding",
"."
] | 60c743da35913d72f37f2d79afa90ad2bf73cb89 | https://github.com/vipshop/vjtools/blob/60c743da35913d72f37f2d79afa90ad2bf73cb89/vjkit/src/main/java/com/vip/vjtools/vjkit/mapper/XmlMapper.java#L39-L42 |
130,299 | vipshop/vjtools | vjkit/src/main/java/com/vip/vjtools/vjkit/mapper/XmlMapper.java | XmlMapper.toXml | public static String toXml(Object root, Class clazz, String encoding) {
try {
StringWriter writer = new StringWriter();
createMarshaller(clazz, encoding).marshal(root, writer);
return writer.toString();
} catch (JAXBException e) {
throw ExceptionUtil.unchecked(e);
}
} | java | public static String toXml(Object root, Class clazz, String encoding) {
try {
StringWriter writer = new StringWriter();
createMarshaller(clazz, encoding).marshal(root, writer);
return writer.toString();
} catch (JAXBException e) {
throw ExceptionUtil.unchecked(e);
}
} | [
"public",
"static",
"String",
"toXml",
"(",
"Object",
"root",
",",
"Class",
"clazz",
",",
"String",
"encoding",
")",
"{",
"try",
"{",
"StringWriter",
"writer",
"=",
"new",
"StringWriter",
"(",
")",
";",
"createMarshaller",
"(",
"clazz",
",",
"encoding",
")... | Java Object->Xml with encoding. | [
"Java",
"Object",
"-",
">",
"Xml",
"with",
"encoding",
"."
] | 60c743da35913d72f37f2d79afa90ad2bf73cb89 | https://github.com/vipshop/vjtools/blob/60c743da35913d72f37f2d79afa90ad2bf73cb89/vjkit/src/main/java/com/vip/vjtools/vjkit/mapper/XmlMapper.java#L55-L63 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.