Skip to content

Commit

Permalink
Merge pull request #15723 from Ladicek/jandex-2.4.3
Browse files Browse the repository at this point in the history
[WFLY-16569] Avoid Jandex 2.4.3.Final deprecated methods
  • Loading branch information
darranl committed Jul 6, 2022
2 parents 5b3fbb2 + ac2fb23 commit 9f634e9
Show file tree
Hide file tree
Showing 16 changed files with 41 additions and 41 deletions.
Expand Up @@ -74,7 +74,7 @@ private void processAroundInvoke(final EEModuleDescription eeModuleDescription,
final MethodInfo methodInfo = MethodInfo.class.cast(target);
final ClassInfo classInfo = methodInfo.declaringClass();
final EEModuleClassDescription classDescription = eeModuleDescription.addOrGetLocalClassDescription(classInfo.name().toString());
final List<AnnotationInstance> classAroundInvokes = classInfo.annotations().get(AROUND_INVOKE_ANNOTATION_NAME);
final List<AnnotationInstance> classAroundInvokes = classInfo.annotationsMap().get(AROUND_INVOKE_ANNOTATION_NAME);
if(classAroundInvokes.size() > 1) {
throw EeLogger.ROOT_LOGGER.aroundInvokeAnnotationUsedTooManyTimes(classInfo.name(), classAroundInvokes.size());
}
Expand Down
Expand Up @@ -279,11 +279,11 @@ private SessionType determineSessionType(final String ejbClass, final CompositeI
if (info == null) {
return null;
}
if(info.annotations().get(STATEFUL_ANNOTATION) != null) {
if(info.annotationsMap().get(STATEFUL_ANNOTATION) != null) {
return SessionType.Stateful;
} else if(info.annotations().get(STATELESS_ANNOTATION) != null) {
} else if(info.annotationsMap().get(STATELESS_ANNOTATION) != null) {
return SessionType.Stateless;
} else if(info.annotations().get(SINGLETON_ANNOTATION) != null) {
} else if(info.annotationsMap().get(SINGLETON_ANNOTATION) != null) {
return SessionType.Singleton;
}
return null;
Expand Down
Expand Up @@ -271,7 +271,7 @@ private HashMap<String, List<Validator>> getParamConverters(
Object object = ctor.newInstance();

List<AnnotationInstance> lazyLoadAnnotations =classInfo
.annotations().get(PARAM_CONVERTER_LAZY_DOTNAME);
.annotationsMap().get(PARAM_CONVERTER_LAZY_DOTNAME);

if (object instanceof ParamConverterProvider) {
ParamConverterProvider pcpObj = (ParamConverterProvider) object;
Expand Down Expand Up @@ -349,7 +349,7 @@ private ArrayList<ParamDetail> getResouceClasses(final CompositeIndex index,
ClassInfo classInfo = indexer.index(stream);

List<AnnotationInstance> defaultValuesList =
classInfo.annotations().get(DEFAULT_VALUE_DOTNAME);
classInfo.annotationsMap().get(DEFAULT_VALUE_DOTNAME);

if (!defaultValuesList.isEmpty()) {
classNameArr.add((classInfo).name().toString());
Expand All @@ -369,7 +369,7 @@ private ArrayList<ParamDetail> getResouceClasses(final CompositeIndex index,
ClassInfo classInfo = index.getClassByName(DotName.createSimple(clazzName));
if (classInfo != null) {
Map<DotName, List<AnnotationInstance>> annotationsMap =
classInfo.annotations();
classInfo.annotationsMap();

if (annotationsMap != null && !annotationsMap.isEmpty()) {
List<AnnotationInstance> xInstance = annotationsMap.get(
Expand Down
Expand Up @@ -198,7 +198,7 @@ private void processDeclaredApplicationClasses(final DeploymentUnit du,
if (cClazz.isAnnotationPresent(javax.ws.rs.Path.class)) {
final ClassInfo info = resourceMap.get(cClazz.getName());
if (info != null) {
if (info.annotations().containsKey(DECORATOR)) {
if (info.annotationsMap().containsKey(DECORATOR)) {
//we do not add decorators as resources
//we can't pick up on programatically added decorators, but that is such an edge case it should not really matter
continue;
Expand Down Expand Up @@ -342,7 +342,7 @@ protected void scan(final DeploymentUnit du, final ClassLoader classLoader, fina
//see WFLY-9752
continue;
}
if(info.annotations().containsKey(DECORATOR)) {
if(info.annotationsMap().containsKey(DECORATOR)) {
//we do not add decorators as resources
//we can't pick up on programatically added decorators, but that is such an edge case it should not really matter
continue;
Expand All @@ -364,7 +364,7 @@ protected void scan(final DeploymentUnit du, final ClassLoader classLoader, fina
//see WFLY-9752
continue;
}
if(info.annotations().containsKey(DECORATOR)) {
if(info.annotationsMap().containsKey(DECORATOR)) {
//we do not add decorators as providers
//we can't pick up on programatically added decorators, but that is such an edge case it should not really matter
continue;
Expand All @@ -388,7 +388,7 @@ protected void scan(final DeploymentUnit du, final ClassLoader classLoader, fina
continue;
}

if(implementor.annotations().containsKey(DECORATOR)) {
if(implementor.annotationsMap().containsKey(DECORATOR)) {
//we do not add decorators as resources
//we can't pick up on programatically added decorators, but that is such an edge case it should not really matter
continue;
Expand Down
Expand Up @@ -84,11 +84,11 @@ private boolean isBridgeRequired(final DeploymentUnit deploymentUnit) {
if (target instanceof ClassInfo) {
final ClassInfo classInfo = (ClassInfo) target;

if (classInfo.annotations().get(TRANSACTIONAL_DOT_NAME) != null) {
if (classInfo.annotationsMap().get(TRANSACTIONAL_DOT_NAME) != null) {
return true;
}
if (classInfo.annotations().get(STATELESS_ATTRIBUTE_DOT_NAME) != null ||
classInfo.annotations().get(STATEFUL_ATTRIBUTE_DOT_NAME) != null) {
if (classInfo.annotationsMap().get(STATELESS_ATTRIBUTE_DOT_NAME) != null ||
classInfo.annotationsMap().get(STATEFUL_ATTRIBUTE_DOT_NAME) != null) {
return true;
}
}
Expand Down
Expand Up @@ -103,7 +103,7 @@ public void configure(DeploymentPhaseContext context, ComponentConfiguration com
}

static boolean isEjb3(final ClassInfo clazz) {
return clazz.annotations().containsKey(STATELESS_ANNOTATION) || clazz.annotations().containsKey(SINGLETON_ANNOTATION);
return clazz.annotationsMap().containsKey(STATELESS_ANNOTATION) || clazz.annotationsMap().containsKey(SINGLETON_ANNOTATION);
}

}
Expand Up @@ -53,7 +53,7 @@ public class ConfigResolver extends AbstractCommonConfigResolver {
public ConfigResolver(ClassInfo epClassInfo, JBossWebservicesMetaData jwmd, JBossWebMetaData jbwebmd, VirtualFile root, boolean isWar) {
this.epClassInfo = epClassInfo;
this.className = epClassInfo.name().toString();
List<AnnotationInstance> annotations = epClassInfo.annotations().get(
List<AnnotationInstance> annotations = epClassInfo.annotationsMap().get(
DotName.createSimple(EndpointConfig.class.getName()));
if (annotations != null && !annotations.isEmpty()) {
AnnotationInstance ann = annotations.get(0);
Expand Down Expand Up @@ -90,7 +90,7 @@ protected String getEndpointClassName() {

@Override
protected <T extends Annotation> boolean isEndpointClassAnnotated(Class<T> annotation) {
return epClassInfo.annotations().containsKey(DotName.createSimple(annotation.getName()));
return epClassInfo.annotationsMap().containsKey(DotName.createSimple(annotation.getName()));
}

@Override
Expand Down
Expand Up @@ -127,7 +127,7 @@ private void verifyApacheCXFModuleDependencyRequirement(DeploymentUnit unit) {
AnnotationTarget at = ai.target();
if (at instanceof ClassInfo) {
final ClassInfo clazz = (ClassInfo)ai.target();
for (DotName dn : clazz.annotations().keySet()) {
for (DotName dn : clazz.annotationsMap().keySet()) {
if (dn.toString().startsWith("org.apache.cxf")) {
WSLogger.ROOT_LOGGER.missingModuleDependency(dn.toString(), clazz.name().toString(), "org.apache.cxf");
}
Expand Down
Expand Up @@ -114,8 +114,8 @@ private static void processAnnotation(final DeploymentUnit unit, final Class an
}

private static WebContextAnnotationWrapper getWebContextWrapper(final ClassInfo webServiceClassInfo) {
if (!webServiceClassInfo.annotations().containsKey(WEB_CONTEXT_ANNOTATION)) return new WebContextAnnotationWrapper(null);
final AnnotationInstance webContextAnnotation = webServiceClassInfo.annotations().get(WEB_CONTEXT_ANNOTATION).get(0);
if (!webServiceClassInfo.annotationsMap().containsKey(WEB_CONTEXT_ANNOTATION)) return new WebContextAnnotationWrapper(null);
final AnnotationInstance webContextAnnotation = webServiceClassInfo.annotationsMap().get(WEB_CONTEXT_ANNOTATION).get(0);
return new WebContextAnnotationWrapper(webContextAnnotation);
}

Expand Down Expand Up @@ -150,8 +150,8 @@ private static Set<String> getDeclaredSecurityRoles(final DeploymentUnit unit, f
}

// process @RolesAllowed annotation
if (webServiceClassInfo.annotations().containsKey(ROLES_ALLOWED_ANNOTATION)) {
final List<AnnotationInstance> allowedRoles = webServiceClassInfo.annotations().get(ROLES_ALLOWED_ANNOTATION);
if (webServiceClassInfo.annotationsMap().containsKey(ROLES_ALLOWED_ANNOTATION)) {
final List<AnnotationInstance> allowedRoles = webServiceClassInfo.annotationsMap().get(ROLES_ALLOWED_ANNOTATION);
for (final AnnotationInstance allowedRole : allowedRoles) {
if (allowedRole.target().equals(webServiceClassInfo)) {
for (final String roleName : allowedRole.value().asStringArray()) {
Expand All @@ -162,8 +162,8 @@ private static Set<String> getDeclaredSecurityRoles(final DeploymentUnit unit, f
}

// process @DeclareRoles annotation
if (webServiceClassInfo.annotations().containsKey(DECLARE_ROLES_ANNOTATION)) {
final List<AnnotationInstance> declareRoles = webServiceClassInfo.annotations().get(DECLARE_ROLES_ANNOTATION);
if (webServiceClassInfo.annotationsMap().containsKey(DECLARE_ROLES_ANNOTATION)) {
final List<AnnotationInstance> declareRoles = webServiceClassInfo.annotationsMap().get(DECLARE_ROLES_ANNOTATION);
for (final AnnotationInstance declareRole : declareRoles) {
if (declareRole.target().equals(webServiceClassInfo)) {
for (final String roleName : declareRole.value().asStringArray()) {
Expand All @@ -174,8 +174,8 @@ private static Set<String> getDeclaredSecurityRoles(final DeploymentUnit unit, f
}

// process @PermitAll annotation
if (webServiceClassInfo.annotations().containsKey(PERMIT_ALL_ANNOTATION)) {
for (AnnotationInstance permitAll : webServiceClassInfo.annotations().get(PERMIT_ALL_ANNOTATION)) {
if (webServiceClassInfo.annotationsMap().containsKey(PERMIT_ALL_ANNOTATION)) {
for (AnnotationInstance permitAll : webServiceClassInfo.annotationsMap().get(PERMIT_ALL_ANNOTATION)) {
if (permitAll.target().equals(webServiceClassInfo)) {
securityRoles.add("*");
break;
Expand Down
Expand Up @@ -138,12 +138,12 @@ private static void processHandlerChainAnnotations(final ResourceRoot currentRes
}

private static AnnotationInstance getHandlerChainAnnotationInstance(final ClassInfo classInfo) {
List<AnnotationInstance> list = classInfo.annotations().get(HANDLER_CHAIN_ANNOTATION);
List<AnnotationInstance> list = classInfo.annotationsMap().get(HANDLER_CHAIN_ANNOTATION);
return list != null && !list.isEmpty() ? list.iterator().next() : null;
}

private static AnnotationInstance getEndpointInterfaceHandlerChainAnnotationInstance(final ClassInfo classInfo, final Index index) {
AnnotationValue av = classInfo.annotations().get(WEB_SERVICE_ANNOTATION).iterator().next().value("endpointInterface");
AnnotationValue av = classInfo.annotationsMap().get(WEB_SERVICE_ANNOTATION).iterator().next().value("endpointInterface");
if (av != null) {
String intf = av.asString();
if (intf != null && !intf.isEmpty()) {
Expand Down Expand Up @@ -222,8 +222,8 @@ private static boolean isJaxwsEndpoint(final ClassInfo clazz, final Index index)
if (!Modifier.isPublic(flags)) return false;
if (isJaxwsService(clazz, index)) return false;
if (Modifier.isFinal(flags)) return false;
final boolean isWebService = clazz.annotations().containsKey(WEB_SERVICE_ANNOTATION);
final boolean isWebServiceProvider = clazz.annotations().containsKey(WEB_SERVICE_PROVIDER_ANNOTATION);
final boolean isWebService = clazz.annotationsMap().containsKey(WEB_SERVICE_ANNOTATION);
final boolean isWebServiceProvider = clazz.annotationsMap().containsKey(WEB_SERVICE_PROVIDER_ANNOTATION);
return isWebService || isWebServiceProvider;
}
}
Expand Up @@ -201,7 +201,7 @@ public static boolean isJaxwsEndpointInterface(final ClassInfo clazz) {
final short flags = clazz.flags();
if (!Modifier.isInterface(flags)) return false;
if (!Modifier.isPublic(flags)) return false;
return clazz.annotations().containsKey(WEB_SERVICE_ANNOTATION);
return clazz.annotationsMap().containsKey(WEB_SERVICE_ANNOTATION);
}

public static boolean hasClassesFromPackage(final Index index, final String pck) {
Expand All @@ -224,8 +224,8 @@ public static boolean isJaxwsEndpoint(final ClassInfo clazz, final CompositeInde
if (Modifier.isAbstract(flags)) return false;
if (!Modifier.isPublic(flags)) return false;
if (isJaxwsService(clazz, index)) return false;
final boolean hasWebServiceAnnotation = clazz.annotations().containsKey(WEB_SERVICE_ANNOTATION);
final boolean hasWebServiceProviderAnnotation = clazz.annotations().containsKey(WEB_SERVICE_PROVIDER_ANNOTATION);
final boolean hasWebServiceAnnotation = clazz.annotationsMap().containsKey(WEB_SERVICE_ANNOTATION);
final boolean hasWebServiceProviderAnnotation = clazz.annotationsMap().containsKey(WEB_SERVICE_PROVIDER_ANNOTATION);
if (!hasWebServiceAnnotation && !hasWebServiceProviderAnnotation) {
return false;
}
Expand Down
Expand Up @@ -381,7 +381,7 @@ private Set<URL> findExportedResource(Module dependencyModule, String name) {
}

private boolean hasBeanDefiningAnnotation(ClassInfo classInfo, Set<AnnotationType> beanDefiningAnnotations) {
Map<DotName, List<AnnotationInstance>> annotationsMap = classInfo.annotations();
Map<DotName, List<AnnotationInstance>> annotationsMap = classInfo.annotationsMap();
for (AnnotationType beanDefiningAnnotation : beanDefiningAnnotations) {
List<AnnotationInstance> annotations = annotationsMap.get(beanDefiningAnnotation.getName());
if (annotations != null) {
Expand Down
Expand Up @@ -41,7 +41,7 @@ public String apply(AnnotationType input) {
public static final Function<ClassInfo, AnnotationType> FOR_CLASSINFO = new Function<ClassInfo, AnnotationType>() {
@Override
public AnnotationType apply(ClassInfo clazz) {
return new AnnotationType(clazz.name(), clazz.annotations().containsKey(Indices.INHERITED_NAME));
return new AnnotationType(clazz.name(), clazz.annotationsMap().containsKey(Indices.INHERITED_NAME));
}
};

Expand Down
Expand Up @@ -184,7 +184,7 @@ private boolean isAnnotationDeclared(ClassInfo classInfo, Class<? extends Annota
}

private boolean isAnnotationDeclared(ClassInfo classInfo, DotName requiredAnnotationName) {
List<AnnotationInstance> annotations = classInfo.annotations().get(requiredAnnotationName);
List<AnnotationInstance> annotations = classInfo.annotationsMap().get(requiredAnnotationName);
if (annotations != null) {
for (AnnotationInstance annotationInstance : annotations) {
if (annotationInstance.target().equals(classInfo)) {
Expand All @@ -196,7 +196,7 @@ private boolean isAnnotationDeclared(ClassInfo classInfo, DotName requiredAnnota
}

private boolean hasInjectConstructor() {
List<AnnotationInstance> annotationInstances = classInfo.annotations().get(DOT_NAME_INJECT);
List<AnnotationInstance> annotationInstances = classInfo.annotationsMap().get(DOT_NAME_INJECT);
if (annotationInstances != null) {
for (AnnotationInstance instance : annotationInstances) {
AnnotationTarget target = instance.target();
Expand Down Expand Up @@ -295,11 +295,11 @@ private boolean isAssignableTo(DotName name, Class<?> to) {

private boolean containsAnnotation(ClassInfo classInfo, DotName requiredAnnotationName, Class<? extends Annotation> requiredAnnotation) {
// Type and members
if (classInfo.annotations().containsKey(requiredAnnotationName)) {
if (classInfo.annotationsMap().containsKey(requiredAnnotationName)) {
return true;
}
// Meta-annotations
for (DotName annotation : classInfo.annotations().keySet()) {
for (DotName annotation : classInfo.annotationsMap().keySet()) {
if (annotationClassAnnotationsCache.getValue(annotation).contains(requiredAnnotationName.toString())) {
return true;
}
Expand Down
Expand Up @@ -55,7 +55,7 @@ public Set<String> apply(DotName name) {
ImmutableSet.Builder<String> builder = ImmutableSet.builder();

if (annotationClassInfo != null) {
for (DotName annotationName : annotationClassInfo.annotations().keySet()) {
for (DotName annotationName : annotationClassInfo.annotationsMap().keySet()) {
builder.add(annotationName.toString());
}
} else {
Expand Down
Expand Up @@ -99,7 +99,7 @@ private boolean isTransactionalEndpointPresent(final CompositeIndex compositeInd
if (target instanceof ClassInfo) {
final ClassInfo classInfo = (ClassInfo) target;

if (classInfo.annotations().get(DotName.createSimple(WebService.class.getName())) != null) {
if (classInfo.annotationsMap().get(DotName.createSimple(WebService.class.getName())) != null) {
return true;
}
}
Expand Down

0 comments on commit 9f634e9

Please sign in to comment.