Skip to content

Commit

Permalink
Merge pull request quarkusio#24454 from rsvoboda/misc.updates.2022-03-21
Browse files Browse the repository at this point in the history
Misc updates in codebase to be a bit more efficient
  • Loading branch information
geoand authored Mar 22, 2022
2 parents a8b43d5 + 8c3c556 commit 5742fb0
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 33 deletions.
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

0 comments on commit 5742fb0

Please sign in to comment.