Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Misc updates in codebase to be a bit more efficient #24454

Merged
merged 3 commits into from
Mar 22, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -121,9 +121,7 @@ List<AnnotationInstance> findAnnotations(AnnotationTarget target, DotName annota
ret.add(annotation);
}
if (container != null) {
for (AnnotationInstance nested : container.value().asNestedArray()) {
ret.add(nested);
}
Collections.addAll(ret, container.value().asNestedArray());
}
return ret;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,9 +66,9 @@ public static Map<String, String> captureProperties(Map<String, String> config,
final Map<String, String> properties = new HashMap<>();

// Rename and store properties
for (String name : config.keySet()) {
String key = prefix + camelHumpify(name);
properties.put(key, config.get(name));
for (Map.Entry<String, String> entry : config.entrySet()) {
String key = prefix + camelHumpify(entry.getKey());
properties.put(key, entry.getValue());
}
return properties;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import java.lang.reflect.Modifier;
import java.util.Arrays;
import java.util.Collection;
import java.util.Collections;
import java.util.HashSet;
import java.util.List;
import java.util.Objects;
Expand Down Expand Up @@ -87,9 +88,7 @@ void reflectionConfiguration(CombinedIndexBuildItem combinedIndexBuildItem,
if (value.kind() == Kind.CLASS) {
typeAnnotationValues.add(value.asClass());
} else if (value.kind() == Kind.ARRAY && value.componentKind() == Kind.CLASS) {
for (Type componentClass : value.asClassArray()) {
typeAnnotationValues.add(componentClass);
}
Collections.addAll(typeAnnotationValues, value.asClassArray());
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -212,9 +212,7 @@ List<MessageBundleBuildItem> processBundles(BeanArchiveIndexBuildItem beanArchiv
if (Modifier.isInterface(localized.flags())) {
if (!localizedInterfaces.contains(localized.name())) {
throw new MessageBundleException(
String.format(
"A localized message bundle interface must extend a message bundle interface: "
+ localized));
"A localized message bundle interface must extend a message bundle interface: " + localized);
}
} else {
throw new MessageBundleException("@Localized must be declared on an interface: " + localized);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -680,15 +680,11 @@ private void processAnnotations(IndexView index, WebMetaData metaData) {
List<String> urlPatterns = new ArrayList<String>();
AnnotationValue urlPatternsValue = annotation.value("urlPatterns");
if (urlPatternsValue != null) {
for (String urlPattern : urlPatternsValue.asStringArray()) {
urlPatterns.add(urlPattern);
}
Collections.addAll(urlPatterns, urlPatternsValue.asStringArray());
}
urlPatternsValue = annotation.value();
if (urlPatternsValue != null) {
for (String urlPattern : urlPatternsValue.asStringArray()) {
urlPatterns.add(urlPattern);
}
Collections.addAll(urlPatterns, urlPatternsValue.asStringArray());
}
if (urlPatterns.size() > 0) {
servletMapping.setUrlPatterns(urlPatterns);
Expand Down Expand Up @@ -747,24 +743,18 @@ private void processAnnotations(IndexView index, WebMetaData metaData) {
List<DispatcherType> dispatchers = new ArrayList<DispatcherType>();
AnnotationValue urlPatternsValue = annotation.value("urlPatterns");
if (urlPatternsValue != null) {
for (String urlPattern : urlPatternsValue.asStringArray()) {
urlPatterns.add(urlPattern);
}
Collections.addAll(urlPatterns, urlPatternsValue.asStringArray());
}
urlPatternsValue = annotation.value();
if (urlPatternsValue != null) {
for (String urlPattern : urlPatternsValue.asStringArray()) {
urlPatterns.add(urlPattern);
}
Collections.addAll(urlPatterns, urlPatternsValue.asStringArray());
}
if (urlPatterns.size() > 0) {
filterMapping.setUrlPatterns(urlPatterns);
}
AnnotationValue servletNamesValue = annotation.value("servletNames");
if (servletNamesValue != null) {
for (String servletName : servletNamesValue.asStringArray()) {
servletNames.add(servletName);
}
Collections.addAll(servletNames, servletNamesValue.asStringArray());
}
if (servletNames.size() > 0) {
filterMapping.setServletNames(servletNames);
Expand Down Expand Up @@ -916,9 +906,7 @@ private void processAnnotations(IndexView index, WebMetaData metaData) {
}
AnnotationValue rolesAllowedValue = httpConstraint.value("rolesAllowed");
if (rolesAllowedValue != null) {
for (String role : rolesAllowedValue.asStringArray()) {
rolesAllowed.add(role);
}
Collections.addAll(rolesAllowed, rolesAllowedValue.asStringArray());
}
}
servletSecurity.setRolesAllowed(rolesAllowed);
Expand Down Expand Up @@ -946,9 +934,7 @@ private void processAnnotations(IndexView index, WebMetaData metaData) {
AnnotationValue rolesAllowedValue = httpMethodConstraint.value("rolesAllowed");
rolesAllowed = new ArrayList<String>();
if (rolesAllowedValue != null) {
for (String role : rolesAllowedValue.asStringArray()) {
rolesAllowed.add(role);
}
Collections.addAll(rolesAllowed, rolesAllowedValue.asStringArray());
}
methodConstraint.setRolesAllowed(rolesAllowed);
methodConstraints.add(methodConstraint);
Expand Down