1f8057104af9cae031b544e971a52adafa7c0d9eThe Android Open Source Project/* 2f8057104af9cae031b544e971a52adafa7c0d9eThe Android Open Source Project * Copyright (C) 2009 The Android Open Source Project 3f8057104af9cae031b544e971a52adafa7c0d9eThe Android Open Source Project * 4f8057104af9cae031b544e971a52adafa7c0d9eThe Android Open Source Project * Licensed under the Apache License, Version 2.0 (the "License"); 5f8057104af9cae031b544e971a52adafa7c0d9eThe Android Open Source Project * you may not use this file except in compliance with the License. 6f8057104af9cae031b544e971a52adafa7c0d9eThe Android Open Source Project * You may obtain a copy of the License at 7f8057104af9cae031b544e971a52adafa7c0d9eThe Android Open Source Project * 8f8057104af9cae031b544e971a52adafa7c0d9eThe Android Open Source Project * http://www.apache.org/licenses/LICENSE-2.0 9f8057104af9cae031b544e971a52adafa7c0d9eThe Android Open Source Project * 10f8057104af9cae031b544e971a52adafa7c0d9eThe Android Open Source Project * Unless required by applicable law or agreed to in writing, software 11f8057104af9cae031b544e971a52adafa7c0d9eThe Android Open Source Project * distributed under the License is distributed on an "AS IS" BASIS, 12f8057104af9cae031b544e971a52adafa7c0d9eThe Android Open Source Project * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13f8057104af9cae031b544e971a52adafa7c0d9eThe Android Open Source Project * See the License for the specific language governing permissions and 14f8057104af9cae031b544e971a52adafa7c0d9eThe Android Open Source Project * limitations under the License. 15f8057104af9cae031b544e971a52adafa7c0d9eThe Android Open Source Project */ 16f8057104af9cae031b544e971a52adafa7c0d9eThe Android Open Source Project 17f8057104af9cae031b544e971a52adafa7c0d9eThe Android Open Source Projectpackage signature.converter.doclet; 18f8057104af9cae031b544e971a52adafa7c0d9eThe Android Open Source Project 19f8057104af9cae031b544e971a52adafa7c0d9eThe Android Open Source Projectimport java.util.EnumSet; 20f8057104af9cae031b544e971a52adafa7c0d9eThe Android Open Source Projectimport java.util.HashMap; 21f8057104af9cae031b544e971a52adafa7c0d9eThe Android Open Source Projectimport java.util.HashSet; 22f8057104af9cae031b544e971a52adafa7c0d9eThe Android Open Source Projectimport java.util.LinkedList; 23f8057104af9cae031b544e971a52adafa7c0d9eThe Android Open Source Projectimport java.util.List; 24f8057104af9cae031b544e971a52adafa7c0d9eThe Android Open Source Projectimport java.util.Map; 25f8057104af9cae031b544e971a52adafa7c0d9eThe Android Open Source Projectimport java.util.Set; 26f8057104af9cae031b544e971a52adafa7c0d9eThe Android Open Source Projectimport java.util.Stack; 27f8057104af9cae031b544e971a52adafa7c0d9eThe Android Open Source Projectimport java.util.Map.Entry; 28f8057104af9cae031b544e971a52adafa7c0d9eThe Android Open Source Project 29f8057104af9cae031b544e971a52adafa7c0d9eThe Android Open Source Projectimport signature.converter.Visibility; 30f8057104af9cae031b544e971a52adafa7c0d9eThe Android Open Source Projectimport signature.model.IAnnotation; 31f8057104af9cae031b544e971a52adafa7c0d9eThe Android Open Source Projectimport signature.model.IAnnotationElement; 32f8057104af9cae031b544e971a52adafa7c0d9eThe Android Open Source Projectimport signature.model.IAnnotationField; 33f8057104af9cae031b544e971a52adafa7c0d9eThe Android Open Source Projectimport signature.model.IApi; 34f8057104af9cae031b544e971a52adafa7c0d9eThe Android Open Source Projectimport signature.model.IClassDefinition; 35f8057104af9cae031b544e971a52adafa7c0d9eThe Android Open Source Projectimport signature.model.IClassReference; 36f8057104af9cae031b544e971a52adafa7c0d9eThe Android Open Source Projectimport signature.model.IConstructor; 37f8057104af9cae031b544e971a52adafa7c0d9eThe Android Open Source Projectimport signature.model.IEnumConstant; 38f8057104af9cae031b544e971a52adafa7c0d9eThe Android Open Source Projectimport signature.model.IField; 39f8057104af9cae031b544e971a52adafa7c0d9eThe Android Open Source Projectimport signature.model.IGenericDeclaration; 40f8057104af9cae031b544e971a52adafa7c0d9eThe Android Open Source Projectimport signature.model.IMethod; 41f8057104af9cae031b544e971a52adafa7c0d9eThe Android Open Source Projectimport signature.model.IPackage; 42f8057104af9cae031b544e971a52adafa7c0d9eThe Android Open Source Projectimport signature.model.IParameter; 43f8057104af9cae031b544e971a52adafa7c0d9eThe Android Open Source Projectimport signature.model.ITypeReference; 44f8057104af9cae031b544e971a52adafa7c0d9eThe Android Open Source Projectimport signature.model.ITypeVariableDefinition; 45f8057104af9cae031b544e971a52adafa7c0d9eThe Android Open Source Projectimport signature.model.ITypeVariableReference; 46f8057104af9cae031b544e971a52adafa7c0d9eThe Android Open Source Projectimport signature.model.Kind; 47f8057104af9cae031b544e971a52adafa7c0d9eThe Android Open Source Projectimport signature.model.Modifier; 48f8057104af9cae031b544e971a52adafa7c0d9eThe Android Open Source Projectimport signature.model.impl.SigAnnotation; 49f8057104af9cae031b544e971a52adafa7c0d9eThe Android Open Source Projectimport signature.model.impl.SigAnnotationElement; 50f8057104af9cae031b544e971a52adafa7c0d9eThe Android Open Source Projectimport signature.model.impl.SigAnnotationField; 51f8057104af9cae031b544e971a52adafa7c0d9eThe Android Open Source Projectimport signature.model.impl.SigApi; 52f8057104af9cae031b544e971a52adafa7c0d9eThe Android Open Source Projectimport signature.model.impl.SigClassDefinition; 53f8057104af9cae031b544e971a52adafa7c0d9eThe Android Open Source Projectimport signature.model.impl.SigClassReference; 54f8057104af9cae031b544e971a52adafa7c0d9eThe Android Open Source Projectimport signature.model.impl.SigConstructor; 55f8057104af9cae031b544e971a52adafa7c0d9eThe Android Open Source Projectimport signature.model.impl.SigEnumConstant; 56f8057104af9cae031b544e971a52adafa7c0d9eThe Android Open Source Projectimport signature.model.impl.SigExecutableMember; 57f8057104af9cae031b544e971a52adafa7c0d9eThe Android Open Source Projectimport signature.model.impl.SigField; 58f8057104af9cae031b544e971a52adafa7c0d9eThe Android Open Source Projectimport signature.model.impl.SigMethod; 59f8057104af9cae031b544e971a52adafa7c0d9eThe Android Open Source Projectimport signature.model.impl.SigPackage; 60f8057104af9cae031b544e971a52adafa7c0d9eThe Android Open Source Projectimport signature.model.impl.SigParameter; 61f8057104af9cae031b544e971a52adafa7c0d9eThe Android Open Source Projectimport signature.model.impl.SigPrimitiveType; 62f8057104af9cae031b544e971a52adafa7c0d9eThe Android Open Source Projectimport signature.model.impl.SigTypeVariableDefinition; 63f8057104af9cae031b544e971a52adafa7c0d9eThe Android Open Source Projectimport signature.model.impl.SigTypeVariableReference; 64f8057104af9cae031b544e971a52adafa7c0d9eThe Android Open Source Projectimport signature.model.util.TypePool; 65f8057104af9cae031b544e971a52adafa7c0d9eThe Android Open Source Project 66f8057104af9cae031b544e971a52adafa7c0d9eThe Android Open Source Projectimport com.sun.javadoc.AnnotationDesc; 67f8057104af9cae031b544e971a52adafa7c0d9eThe Android Open Source Projectimport com.sun.javadoc.AnnotationTypeDoc; 68f8057104af9cae031b544e971a52adafa7c0d9eThe Android Open Source Projectimport com.sun.javadoc.AnnotationTypeElementDoc; 69f8057104af9cae031b544e971a52adafa7c0d9eThe Android Open Source Projectimport com.sun.javadoc.AnnotationValue; 70f8057104af9cae031b544e971a52adafa7c0d9eThe Android Open Source Projectimport com.sun.javadoc.ClassDoc; 71f8057104af9cae031b544e971a52adafa7c0d9eThe Android Open Source Projectimport com.sun.javadoc.ConstructorDoc; 72f8057104af9cae031b544e971a52adafa7c0d9eThe Android Open Source Projectimport com.sun.javadoc.ExecutableMemberDoc; 73f8057104af9cae031b544e971a52adafa7c0d9eThe Android Open Source Projectimport com.sun.javadoc.FieldDoc; 74f8057104af9cae031b544e971a52adafa7c0d9eThe Android Open Source Projectimport com.sun.javadoc.MethodDoc; 75f8057104af9cae031b544e971a52adafa7c0d9eThe Android Open Source Projectimport com.sun.javadoc.PackageDoc; 76f8057104af9cae031b544e971a52adafa7c0d9eThe Android Open Source Projectimport com.sun.javadoc.Parameter; 77f8057104af9cae031b544e971a52adafa7c0d9eThe Android Open Source Projectimport com.sun.javadoc.ParameterizedType; 78f8057104af9cae031b544e971a52adafa7c0d9eThe Android Open Source Projectimport com.sun.javadoc.ProgramElementDoc; 79f8057104af9cae031b544e971a52adafa7c0d9eThe Android Open Source Projectimport com.sun.javadoc.RootDoc; 80f8057104af9cae031b544e971a52adafa7c0d9eThe Android Open Source Projectimport com.sun.javadoc.Type; 81f8057104af9cae031b544e971a52adafa7c0d9eThe Android Open Source Projectimport com.sun.javadoc.TypeVariable; 82f8057104af9cae031b544e971a52adafa7c0d9eThe Android Open Source Projectimport com.sun.javadoc.WildcardType; 83f8057104af9cae031b544e971a52adafa7c0d9eThe Android Open Source Projectimport com.sun.javadoc.AnnotationDesc.ElementValuePair; 84f8057104af9cae031b544e971a52adafa7c0d9eThe Android Open Source Project 85f8057104af9cae031b544e971a52adafa7c0d9eThe Android Open Source Projectpublic class DocletToSigConverter { 86f8057104af9cae031b544e971a52adafa7c0d9eThe Android Open Source Project 87f8057104af9cae031b544e971a52adafa7c0d9eThe Android Open Source Project TypePool pool; 88f8057104af9cae031b544e971a52adafa7c0d9eThe Android Open Source Project Set<String> packageNames; 89f8057104af9cae031b544e971a52adafa7c0d9eThe Android Open Source Project 90f8057104af9cae031b544e971a52adafa7c0d9eThe Android Open Source Project /** 91f8057104af9cae031b544e971a52adafa7c0d9eThe Android Open Source Project * Converts the signature information javadoc knows about into a 92f8057104af9cae031b544e971a52adafa7c0d9eThe Android Open Source Project * signature.model.ISources structure. 93f8057104af9cae031b544e971a52adafa7c0d9eThe Android Open Source Project */ 94f8057104af9cae031b544e971a52adafa7c0d9eThe Android Open Source Project public IApi convertDocletRoot(String name, RootDoc root, 95f8057104af9cae031b544e971a52adafa7c0d9eThe Android Open Source Project Visibility visibility, Set<String> packageNames) { 96f8057104af9cae031b544e971a52adafa7c0d9eThe Android Open Source Project this.pool = new TypePool(); 97f8057104af9cae031b544e971a52adafa7c0d9eThe Android Open Source Project this.packageNames = packageNames; 98f8057104af9cae031b544e971a52adafa7c0d9eThe Android Open Source Project 99f8057104af9cae031b544e971a52adafa7c0d9eThe Android Open Source Project Set<IPackage> packages = new HashSet<IPackage>(); 100f8057104af9cae031b544e971a52adafa7c0d9eThe Android Open Source Project 101f8057104af9cae031b544e971a52adafa7c0d9eThe Android Open Source Project for (PackageDoc pack : root.specifiedPackages()) { 102f8057104af9cae031b544e971a52adafa7c0d9eThe Android Open Source Project assert packageNames.contains(pack.name()); 103f8057104af9cae031b544e971a52adafa7c0d9eThe Android Open Source Project packages.add(convertPackage(pack)); 104f8057104af9cae031b544e971a52adafa7c0d9eThe Android Open Source Project } 105f8057104af9cae031b544e971a52adafa7c0d9eThe Android Open Source Project 106f8057104af9cae031b544e971a52adafa7c0d9eThe Android Open Source Project SigApi sources = new SigApi(name, visibility); 107f8057104af9cae031b544e971a52adafa7c0d9eThe Android Open Source Project sources.setPackages(packages); 108f8057104af9cae031b544e971a52adafa7c0d9eThe Android Open Source Project return sources; 109f8057104af9cae031b544e971a52adafa7c0d9eThe Android Open Source Project } 110f8057104af9cae031b544e971a52adafa7c0d9eThe Android Open Source Project 111f8057104af9cae031b544e971a52adafa7c0d9eThe Android Open Source Project private IPackage convertPackage(PackageDoc packageDoc) { 112f8057104af9cae031b544e971a52adafa7c0d9eThe Android Open Source Project Set<IClassDefinition> classes = new HashSet<IClassDefinition>(); 113f8057104af9cae031b544e971a52adafa7c0d9eThe Android Open Source Project for (ClassDoc clazz : packageDoc.allClasses()) { 114f8057104af9cae031b544e971a52adafa7c0d9eThe Android Open Source Project // classes.add((IClass)convertType(clazz)); 115f8057104af9cae031b544e971a52adafa7c0d9eThe Android Open Source Project classes.add(convertClass(clazz)); 116f8057104af9cae031b544e971a52adafa7c0d9eThe Android Open Source Project } 117f8057104af9cae031b544e971a52adafa7c0d9eThe Android Open Source Project 118f8057104af9cae031b544e971a52adafa7c0d9eThe Android Open Source Project SigPackage p = new SigPackage(packageDoc.name()); 119f8057104af9cae031b544e971a52adafa7c0d9eThe Android Open Source Project p.setClasses(classes); 120f8057104af9cae031b544e971a52adafa7c0d9eThe Android Open Source Project p.setAnnotations(convertAnnotations(packageDoc.annotations())); 121f8057104af9cae031b544e971a52adafa7c0d9eThe Android Open Source Project return p; 122f8057104af9cae031b544e971a52adafa7c0d9eThe Android Open Source Project } 123f8057104af9cae031b544e971a52adafa7c0d9eThe Android Open Source Project 124f8057104af9cae031b544e971a52adafa7c0d9eThe Android Open Source Project private SigClassDefinition convertClass(ClassDoc classDoc) { 125f8057104af9cae031b544e971a52adafa7c0d9eThe Android Open Source Project 126f8057104af9cae031b544e971a52adafa7c0d9eThe Android Open Source Project SigClassDefinition c = pool.getClass(classDoc.containingPackage() 127f8057104af9cae031b544e971a52adafa7c0d9eThe Android Open Source Project .name(), classDoc.name()); 128f8057104af9cae031b544e971a52adafa7c0d9eThe Android Open Source Project if (c.getKind() != Kind.UNINITIALIZED) return c; 129f8057104af9cae031b544e971a52adafa7c0d9eThe Android Open Source Project 130f8057104af9cae031b544e971a52adafa7c0d9eThe Android Open Source Project if (classDoc.isEnum()) 131f8057104af9cae031b544e971a52adafa7c0d9eThe Android Open Source Project c.setKind(Kind.ENUM); 132f8057104af9cae031b544e971a52adafa7c0d9eThe Android Open Source Project else if (classDoc.isInterface()) 133f8057104af9cae031b544e971a52adafa7c0d9eThe Android Open Source Project c.setKind(Kind.INTERFACE); 134f8057104af9cae031b544e971a52adafa7c0d9eThe Android Open Source Project else if (classDoc.isClass()) 135f8057104af9cae031b544e971a52adafa7c0d9eThe Android Open Source Project c.setKind(Kind.CLASS); 136f8057104af9cae031b544e971a52adafa7c0d9eThe Android Open Source Project else if (classDoc.isAnnotationType()) c.setKind(Kind.ANNOTATION); 137f8057104af9cae031b544e971a52adafa7c0d9eThe Android Open Source Project 138f8057104af9cae031b544e971a52adafa7c0d9eThe Android Open Source Project if (!packageNames.contains(c.getPackageName())) { 139f8057104af9cae031b544e971a52adafa7c0d9eThe Android Open Source Project // no additional conversion for this class is necessary 140f8057104af9cae031b544e971a52adafa7c0d9eThe Android Open Source Project initializeClass(c); 141f8057104af9cae031b544e971a52adafa7c0d9eThe Android Open Source Project return c; 142f8057104af9cae031b544e971a52adafa7c0d9eThe Android Open Source Project } 143f8057104af9cae031b544e971a52adafa7c0d9eThe Android Open Source Project 144f8057104af9cae031b544e971a52adafa7c0d9eThe Android Open Source Project c.setModifiers(convertModifiers(classDoc.modifierSpecifier())); 145f8057104af9cae031b544e971a52adafa7c0d9eThe Android Open Source Project if (Kind.INTERFACE.equals(c.getKind()) 146f8057104af9cae031b544e971a52adafa7c0d9eThe Android Open Source Project || Kind.ANNOTATION.equals(c.getKind())) { 147f8057104af9cae031b544e971a52adafa7c0d9eThe Android Open Source Project c.getModifiers().add(Modifier.ABSTRACT); 148f8057104af9cae031b544e971a52adafa7c0d9eThe Android Open Source Project } 149f8057104af9cae031b544e971a52adafa7c0d9eThe Android Open Source Project 150f8057104af9cae031b544e971a52adafa7c0d9eThe Android Open Source Project // superclass may be a class or a parameterized type (e.g. extends 151f8057104af9cae031b544e971a52adafa7c0d9eThe Android Open Source Project // List<String>), 152f8057104af9cae031b544e971a52adafa7c0d9eThe Android Open Source Project // may also be null if classDoc is an interface 153f8057104af9cae031b544e971a52adafa7c0d9eThe Android Open Source Project Type superclassType = classDoc.superclassType(); 154f8057104af9cae031b544e971a52adafa7c0d9eThe Android Open Source Project if (superclassType != null) { 155f8057104af9cae031b544e971a52adafa7c0d9eThe Android Open Source Project c.setSuperClass(convertTypeReference(classDoc.superclassType())); 156f8057104af9cae031b544e971a52adafa7c0d9eThe Android Open Source Project } else { 157f8057104af9cae031b544e971a52adafa7c0d9eThe Android Open Source Project c.setSuperClass(null); 158f8057104af9cae031b544e971a52adafa7c0d9eThe Android Open Source Project } 159f8057104af9cae031b544e971a52adafa7c0d9eThe Android Open Source Project 160f8057104af9cae031b544e971a52adafa7c0d9eThe Android Open Source Project Set<ITypeReference> interfaces = new HashSet<ITypeReference>(); 161f8057104af9cae031b544e971a52adafa7c0d9eThe Android Open Source Project for (Type interfaceType : classDoc.interfaceTypes()) { 162f8057104af9cae031b544e971a52adafa7c0d9eThe Android Open Source Project interfaces.add(convertTypeReference(interfaceType)); 163f8057104af9cae031b544e971a52adafa7c0d9eThe Android Open Source Project } 164f8057104af9cae031b544e971a52adafa7c0d9eThe Android Open Source Project c.setInterfaces(interfaces); 165f8057104af9cae031b544e971a52adafa7c0d9eThe Android Open Source Project 166f8057104af9cae031b544e971a52adafa7c0d9eThe Android Open Source Project ClassDoc containingClass = classDoc.containingClass(); 167f8057104af9cae031b544e971a52adafa7c0d9eThe Android Open Source Project if (containingClass != null) 168f8057104af9cae031b544e971a52adafa7c0d9eThe Android Open Source Project c.setDeclaringClass(convertClass(containingClass)); 169f8057104af9cae031b544e971a52adafa7c0d9eThe Android Open Source Project else 170f8057104af9cae031b544e971a52adafa7c0d9eThe Android Open Source Project c.setDeclaringClass(null); 171f8057104af9cae031b544e971a52adafa7c0d9eThe Android Open Source Project 172f8057104af9cae031b544e971a52adafa7c0d9eThe Android Open Source Project Set<IClassDefinition> innerClasses = new HashSet<IClassDefinition>(); 173f8057104af9cae031b544e971a52adafa7c0d9eThe Android Open Source Project for (ClassDoc innerClass : classDoc.innerClasses()) { 174f8057104af9cae031b544e971a52adafa7c0d9eThe Android Open Source Project innerClasses.add(convertClass(innerClass)); 175f8057104af9cae031b544e971a52adafa7c0d9eThe Android Open Source Project } 176f8057104af9cae031b544e971a52adafa7c0d9eThe Android Open Source Project c.setInnerClasses(innerClasses); 177f8057104af9cae031b544e971a52adafa7c0d9eThe Android Open Source Project 178f8057104af9cae031b544e971a52adafa7c0d9eThe Android Open Source Project Set<IConstructor> constructors = new HashSet<IConstructor>(); 179f8057104af9cae031b544e971a52adafa7c0d9eThe Android Open Source Project for (ConstructorDoc constructor : classDoc.constructors()) { 180f8057104af9cae031b544e971a52adafa7c0d9eThe Android Open Source Project constructors.add(convertConstructor(constructor)); 181f8057104af9cae031b544e971a52adafa7c0d9eThe Android Open Source Project } 182f8057104af9cae031b544e971a52adafa7c0d9eThe Android Open Source Project c.setConstructors(constructors); 183f8057104af9cae031b544e971a52adafa7c0d9eThe Android Open Source Project 184f8057104af9cae031b544e971a52adafa7c0d9eThe Android Open Source Project Set<IMethod> methods = new HashSet<IMethod>(); 185f8057104af9cae031b544e971a52adafa7c0d9eThe Android Open Source Project for (MethodDoc method : classDoc.methods()) { 186f8057104af9cae031b544e971a52adafa7c0d9eThe Android Open Source Project methods.add(convertMethod(method)); 187f8057104af9cae031b544e971a52adafa7c0d9eThe Android Open Source Project } 188f8057104af9cae031b544e971a52adafa7c0d9eThe Android Open Source Project c.setMethods(methods); 189f8057104af9cae031b544e971a52adafa7c0d9eThe Android Open Source Project 190f8057104af9cae031b544e971a52adafa7c0d9eThe Android Open Source Project Set<IField> fields = new HashSet<IField>(); 191f8057104af9cae031b544e971a52adafa7c0d9eThe Android Open Source Project for (FieldDoc field : classDoc.fields()) { 192f8057104af9cae031b544e971a52adafa7c0d9eThe Android Open Source Project fields.add(convertField(field)); 193f8057104af9cae031b544e971a52adafa7c0d9eThe Android Open Source Project } 194f8057104af9cae031b544e971a52adafa7c0d9eThe Android Open Source Project c.setFields(fields); 195f8057104af9cae031b544e971a52adafa7c0d9eThe Android Open Source Project 196f8057104af9cae031b544e971a52adafa7c0d9eThe Android Open Source Project Set<IEnumConstant> enumConstants = new HashSet<IEnumConstant>(); 197f8057104af9cae031b544e971a52adafa7c0d9eThe Android Open Source Project int ordinal = 0; 198f8057104af9cae031b544e971a52adafa7c0d9eThe Android Open Source Project for (FieldDoc enumConstant : classDoc.enumConstants()) { 199f8057104af9cae031b544e971a52adafa7c0d9eThe Android Open Source Project enumConstants.add(convertEnumConstant(enumConstant, ordinal++)); 200f8057104af9cae031b544e971a52adafa7c0d9eThe Android Open Source Project } 201f8057104af9cae031b544e971a52adafa7c0d9eThe Android Open Source Project c.setEnumConstants(enumConstants); 202f8057104af9cae031b544e971a52adafa7c0d9eThe Android Open Source Project 203f8057104af9cae031b544e971a52adafa7c0d9eThe Android Open Source Project List<ITypeVariableDefinition> typeParameters = 204f8057104af9cae031b544e971a52adafa7c0d9eThe Android Open Source Project new LinkedList<ITypeVariableDefinition>(); 205f8057104af9cae031b544e971a52adafa7c0d9eThe Android Open Source Project for (TypeVariable typeVariable : classDoc.typeParameters()) { 206f8057104af9cae031b544e971a52adafa7c0d9eThe Android Open Source Project typeParameters 207f8057104af9cae031b544e971a52adafa7c0d9eThe Android Open Source Project .add(((ITypeVariableReference) convertTypeReference( 208f8057104af9cae031b544e971a52adafa7c0d9eThe Android Open Source Project typeVariable)).getTypeVariableDefinition()); 209f8057104af9cae031b544e971a52adafa7c0d9eThe Android Open Source Project } 210f8057104af9cae031b544e971a52adafa7c0d9eThe Android Open Source Project c.setTypeParameters(typeParameters); 211f8057104af9cae031b544e971a52adafa7c0d9eThe Android Open Source Project 212f8057104af9cae031b544e971a52adafa7c0d9eThe Android Open Source Project if (classDoc.isAnnotationType()) { 213f8057104af9cae031b544e971a52adafa7c0d9eThe Android Open Source Project Map<SigAnnotationField, AnnotationTypeElementDoc> annotationFieldAnnotations = 214f8057104af9cae031b544e971a52adafa7c0d9eThe Android Open Source Project new HashMap<SigAnnotationField, AnnotationTypeElementDoc>(); 215f8057104af9cae031b544e971a52adafa7c0d9eThe Android Open Source Project 216f8057104af9cae031b544e971a52adafa7c0d9eThe Android Open Source Project // AnnotationTypeDoc annotationType = 217f8057104af9cae031b544e971a52adafa7c0d9eThe Android Open Source Project // classDoc.asAnnotationTypeDoc(); // bug in Doclet Implementation, 218f8057104af9cae031b544e971a52adafa7c0d9eThe Android Open Source Project // has been reported to sun 219f8057104af9cae031b544e971a52adafa7c0d9eThe Android Open Source Project AnnotationTypeDoc annotationType = (AnnotationTypeDoc) classDoc; 220f8057104af9cae031b544e971a52adafa7c0d9eThe Android Open Source Project 221f8057104af9cae031b544e971a52adafa7c0d9eThe Android Open Source Project Set<IAnnotationField> annotationFields = 222f8057104af9cae031b544e971a52adafa7c0d9eThe Android Open Source Project new HashSet<IAnnotationField>(); 223f8057104af9cae031b544e971a52adafa7c0d9eThe Android Open Source Project for (AnnotationTypeElementDoc annotationElement : annotationType 224f8057104af9cae031b544e971a52adafa7c0d9eThe Android Open Source Project .elements()) { 225f8057104af9cae031b544e971a52adafa7c0d9eThe Android Open Source Project SigAnnotationField annotationField = new SigAnnotationField( 226f8057104af9cae031b544e971a52adafa7c0d9eThe Android Open Source Project annotationElement.name()); 227f8057104af9cae031b544e971a52adafa7c0d9eThe Android Open Source Project annotationField.setModifiers(convertModifiers(annotationElement 228f8057104af9cae031b544e971a52adafa7c0d9eThe Android Open Source Project .modifierSpecifier())); 229f8057104af9cae031b544e971a52adafa7c0d9eThe Android Open Source Project annotationField.setType(convertTypeReference(annotationElement 230f8057104af9cae031b544e971a52adafa7c0d9eThe Android Open Source Project .returnType())); 231f8057104af9cae031b544e971a52adafa7c0d9eThe Android Open Source Project annotationField 232f8057104af9cae031b544e971a52adafa7c0d9eThe Android Open Source Project .setDefaultValue(convertAnnotationValue( 233f8057104af9cae031b544e971a52adafa7c0d9eThe Android Open Source Project annotationElement.defaultValue())); 234f8057104af9cae031b544e971a52adafa7c0d9eThe Android Open Source Project 235f8057104af9cae031b544e971a52adafa7c0d9eThe Android Open Source Project // the annotations on fields are set later because these 236f8057104af9cae031b544e971a52adafa7c0d9eThe Android Open Source Project // annotations may be of 237f8057104af9cae031b544e971a52adafa7c0d9eThe Android Open Source Project // the same type and may use fields which are not yet defined 238f8057104af9cae031b544e971a52adafa7c0d9eThe Android Open Source Project annotationFieldAnnotations.put(annotationField, 239f8057104af9cae031b544e971a52adafa7c0d9eThe Android Open Source Project annotationElement); 240f8057104af9cae031b544e971a52adafa7c0d9eThe Android Open Source Project 241f8057104af9cae031b544e971a52adafa7c0d9eThe Android Open Source Project annotationFields.add(annotationField); 242f8057104af9cae031b544e971a52adafa7c0d9eThe Android Open Source Project } 243f8057104af9cae031b544e971a52adafa7c0d9eThe Android Open Source Project c.setAnnotationFields(annotationFields); 244f8057104af9cae031b544e971a52adafa7c0d9eThe Android Open Source Project 245f8057104af9cae031b544e971a52adafa7c0d9eThe Android Open Source Project // set annotation field annotations 246f8057104af9cae031b544e971a52adafa7c0d9eThe Android Open Source Project for (Entry<SigAnnotationField, AnnotationTypeElementDoc> entry : 247f8057104af9cae031b544e971a52adafa7c0d9eThe Android Open Source Project annotationFieldAnnotations.entrySet()) { 248f8057104af9cae031b544e971a52adafa7c0d9eThe Android Open Source Project entry.getKey().setAnnotations( 249f8057104af9cae031b544e971a52adafa7c0d9eThe Android Open Source Project convertAnnotations(entry.getValue().annotations())); 250f8057104af9cae031b544e971a52adafa7c0d9eThe Android Open Source Project } 251f8057104af9cae031b544e971a52adafa7c0d9eThe Android Open Source Project } else { // no annotation type 252f8057104af9cae031b544e971a52adafa7c0d9eThe Android Open Source Project c.setAnnotationFields(null); 253f8057104af9cae031b544e971a52adafa7c0d9eThe Android Open Source Project } 254f8057104af9cae031b544e971a52adafa7c0d9eThe Android Open Source Project 255f8057104af9cae031b544e971a52adafa7c0d9eThe Android Open Source Project // set class annotations 256f8057104af9cae031b544e971a52adafa7c0d9eThe Android Open Source Project c.setAnnotations(convertAnnotations(classDoc.annotations())); 257f8057104af9cae031b544e971a52adafa7c0d9eThe Android Open Source Project 258f8057104af9cae031b544e971a52adafa7c0d9eThe Android Open Source Project return c; 259f8057104af9cae031b544e971a52adafa7c0d9eThe Android Open Source Project 260f8057104af9cae031b544e971a52adafa7c0d9eThe Android Open Source Project } 261f8057104af9cae031b544e971a52adafa7c0d9eThe Android Open Source Project 262f8057104af9cae031b544e971a52adafa7c0d9eThe Android Open Source Project private Object convertAnnotationValue(AnnotationValue annotationValue) { 263f8057104af9cae031b544e971a52adafa7c0d9eThe Android Open Source Project if (annotationValue == null) { 264f8057104af9cae031b544e971a52adafa7c0d9eThe Android Open Source Project return null; 265f8057104af9cae031b544e971a52adafa7c0d9eThe Android Open Source Project } 266f8057104af9cae031b544e971a52adafa7c0d9eThe Android Open Source Project Object value = annotationValue.value(); 267f8057104af9cae031b544e971a52adafa7c0d9eThe Android Open Source Project if (value instanceof Type) { 268f8057104af9cae031b544e971a52adafa7c0d9eThe Android Open Source Project // Type contains primitive types as well, e.g. void.class 269f8057104af9cae031b544e971a52adafa7c0d9eThe Android Open Source Project return convertTypeReference((Type) value); 270f8057104af9cae031b544e971a52adafa7c0d9eThe Android Open Source Project } else if (value instanceof String) { 271f8057104af9cae031b544e971a52adafa7c0d9eThe Android Open Source Project return value; 272f8057104af9cae031b544e971a52adafa7c0d9eThe Android Open Source Project } else if (value instanceof Double || value instanceof Float 273f8057104af9cae031b544e971a52adafa7c0d9eThe Android Open Source Project || value instanceof Long || value instanceof Integer 274f8057104af9cae031b544e971a52adafa7c0d9eThe Android Open Source Project || value instanceof Short || value instanceof Byte 275f8057104af9cae031b544e971a52adafa7c0d9eThe Android Open Source Project || value instanceof Character || value instanceof Boolean) { 276f8057104af9cae031b544e971a52adafa7c0d9eThe Android Open Source Project return value; 277f8057104af9cae031b544e971a52adafa7c0d9eThe Android Open Source Project } else if (value instanceof FieldDoc) { 278f8057104af9cae031b544e971a52adafa7c0d9eThe Android Open Source Project FieldDoc field = (FieldDoc) value; 279f8057104af9cae031b544e971a52adafa7c0d9eThe Android Open Source Project String name = field.name(); 280f8057104af9cae031b544e971a52adafa7c0d9eThe Android Open Source Project ITypeReference fieldType = convertTypeReference(field.type()); 281f8057104af9cae031b544e971a52adafa7c0d9eThe Android Open Source Project IClassReference fieldClassRef = (IClassReference) fieldType; 282f8057104af9cae031b544e971a52adafa7c0d9eThe Android Open Source Project IClassDefinition fieldClass = fieldClassRef.getClassDefinition(); 283f8057104af9cae031b544e971a52adafa7c0d9eThe Android Open Source Project 284f8057104af9cae031b544e971a52adafa7c0d9eThe Android Open Source Project assert fieldClass.getKind() == Kind.ENUM; 285f8057104af9cae031b544e971a52adafa7c0d9eThe Android Open Source Project Set<IEnumConstant> constants = fieldClass.getEnumConstants(); 286f8057104af9cae031b544e971a52adafa7c0d9eThe Android Open Source Project for (IEnumConstant enumConstant : constants) { 287f8057104af9cae031b544e971a52adafa7c0d9eThe Android Open Source Project if (enumConstant.getName().equals(name)) value = enumConstant; 288f8057104af9cae031b544e971a52adafa7c0d9eThe Android Open Source Project } 289f8057104af9cae031b544e971a52adafa7c0d9eThe Android Open Source Project assert value instanceof IEnumConstant; 290f8057104af9cae031b544e971a52adafa7c0d9eThe Android Open Source Project return value; 291f8057104af9cae031b544e971a52adafa7c0d9eThe Android Open Source Project } else if (value instanceof AnnotationDesc) { 292f8057104af9cae031b544e971a52adafa7c0d9eThe Android Open Source Project return convertAnnotation((AnnotationDesc) value); 293f8057104af9cae031b544e971a52adafa7c0d9eThe Android Open Source Project } else if (value instanceof AnnotationValue) { 294f8057104af9cae031b544e971a52adafa7c0d9eThe Android Open Source Project return convertAnnotationValue((AnnotationValue) value); 295f8057104af9cae031b544e971a52adafa7c0d9eThe Android Open Source Project } else if (value instanceof AnnotationValue[]) { 296f8057104af9cae031b544e971a52adafa7c0d9eThe Android Open Source Project AnnotationValue[] arr = (AnnotationValue[]) value; 297f8057104af9cae031b544e971a52adafa7c0d9eThe Android Open Source Project int length = arr.length; 298f8057104af9cae031b544e971a52adafa7c0d9eThe Android Open Source Project Object[] annotationArray = new Object[length]; 299f8057104af9cae031b544e971a52adafa7c0d9eThe Android Open Source Project for (int i = 0; i < length; i++) { 300f8057104af9cae031b544e971a52adafa7c0d9eThe Android Open Source Project annotationArray[i] = convertAnnotationValue(arr[i]); 301f8057104af9cae031b544e971a52adafa7c0d9eThe Android Open Source Project } 302f8057104af9cae031b544e971a52adafa7c0d9eThe Android Open Source Project return annotationArray; 303f8057104af9cae031b544e971a52adafa7c0d9eThe Android Open Source Project } else { 304f8057104af9cae031b544e971a52adafa7c0d9eThe Android Open Source Project throw new RuntimeException("not expected case"); 305f8057104af9cae031b544e971a52adafa7c0d9eThe Android Open Source Project } 306f8057104af9cae031b544e971a52adafa7c0d9eThe Android Open Source Project } 307f8057104af9cae031b544e971a52adafa7c0d9eThe Android Open Source Project 308f8057104af9cae031b544e971a52adafa7c0d9eThe Android Open Source Project private ITypeReference convertArrayType(Type type) { 309f8057104af9cae031b544e971a52adafa7c0d9eThe Android Open Source Project assert type.asWildcardType() == null; 310f8057104af9cae031b544e971a52adafa7c0d9eThe Android Open Source Project assert type.asAnnotationTypeDoc() == null; 311f8057104af9cae031b544e971a52adafa7c0d9eThe Android Open Source Project 312f8057104af9cae031b544e971a52adafa7c0d9eThe Android Open Source Project ITypeReference baseType = null; 313f8057104af9cae031b544e971a52adafa7c0d9eThe Android Open Source Project if (type.asTypeVariable() != null) { 314f8057104af9cae031b544e971a52adafa7c0d9eThe Android Open Source Project baseType = convertTypeReference(type.asTypeVariable()); 315f8057104af9cae031b544e971a52adafa7c0d9eThe Android Open Source Project } else if (type.asParameterizedType() != null) { 316f8057104af9cae031b544e971a52adafa7c0d9eThe Android Open Source Project baseType = convertTypeReference(type.asParameterizedType()); 317f8057104af9cae031b544e971a52adafa7c0d9eThe Android Open Source Project } else if (type.asClassDoc() != null) { 318f8057104af9cae031b544e971a52adafa7c0d9eThe Android Open Source Project baseType = new SigClassReference(convertClass(type.asClassDoc())); 319f8057104af9cae031b544e971a52adafa7c0d9eThe Android Open Source Project } else if (type.isPrimitive()) { 320f8057104af9cae031b544e971a52adafa7c0d9eThe Android Open Source Project baseType = SigPrimitiveType.valueOfTypeName(type.typeName()); 321f8057104af9cae031b544e971a52adafa7c0d9eThe Android Open Source Project } else { 322f8057104af9cae031b544e971a52adafa7c0d9eThe Android Open Source Project throw new RuntimeException(type.toString()); 323f8057104af9cae031b544e971a52adafa7c0d9eThe Android Open Source Project } 324f8057104af9cae031b544e971a52adafa7c0d9eThe Android Open Source Project 325f8057104af9cae031b544e971a52adafa7c0d9eThe Android Open Source Project ITypeReference arrayType = baseType; 326f8057104af9cae031b544e971a52adafa7c0d9eThe Android Open Source Project int dimension = type.dimension().length() / 2; 327f8057104af9cae031b544e971a52adafa7c0d9eThe Android Open Source Project while (dimension > 0) { 328f8057104af9cae031b544e971a52adafa7c0d9eThe Android Open Source Project arrayType = pool.getArrayType(arrayType); 329f8057104af9cae031b544e971a52adafa7c0d9eThe Android Open Source Project dimension--; 330f8057104af9cae031b544e971a52adafa7c0d9eThe Android Open Source Project } 331f8057104af9cae031b544e971a52adafa7c0d9eThe Android Open Source Project 332f8057104af9cae031b544e971a52adafa7c0d9eThe Android Open Source Project return arrayType; 333f8057104af9cae031b544e971a52adafa7c0d9eThe Android Open Source Project } 334f8057104af9cae031b544e971a52adafa7c0d9eThe Android Open Source Project 335f8057104af9cae031b544e971a52adafa7c0d9eThe Android Open Source Project private SigTypeVariableDefinition currentTypeVariableDefinition = null; 336f8057104af9cae031b544e971a52adafa7c0d9eThe Android Open Source Project 337f8057104af9cae031b544e971a52adafa7c0d9eThe Android Open Source Project private ITypeReference convertTypeReference(Type type) { 338f8057104af9cae031b544e971a52adafa7c0d9eThe Android Open Source Project assert type != null; 339f8057104af9cae031b544e971a52adafa7c0d9eThe Android Open Source Project 340f8057104af9cae031b544e971a52adafa7c0d9eThe Android Open Source Project if (!"".equals(type.dimension())) { 341f8057104af9cae031b544e971a52adafa7c0d9eThe Android Open Source Project return convertArrayType(type); 342f8057104af9cae031b544e971a52adafa7c0d9eThe Android Open Source Project } 343f8057104af9cae031b544e971a52adafa7c0d9eThe Android Open Source Project 344f8057104af9cae031b544e971a52adafa7c0d9eThe Android Open Source Project ParameterizedType pType = type.asParameterizedType(); 345f8057104af9cae031b544e971a52adafa7c0d9eThe Android Open Source Project if (pType != null) { 346f8057104af9cae031b544e971a52adafa7c0d9eThe Android Open Source Project ITypeReference ownerType = null; 347f8057104af9cae031b544e971a52adafa7c0d9eThe Android Open Source Project Type containingType = pType.containingType(); 348f8057104af9cae031b544e971a52adafa7c0d9eThe Android Open Source Project if (containingType != null) 349f8057104af9cae031b544e971a52adafa7c0d9eThe Android Open Source Project ownerType = convertTypeReference(containingType); 350f8057104af9cae031b544e971a52adafa7c0d9eThe Android Open Source Project IClassReference rawType = new SigClassReference(convertClass(pType 351f8057104af9cae031b544e971a52adafa7c0d9eThe Android Open Source Project .asClassDoc())); 352f8057104af9cae031b544e971a52adafa7c0d9eThe Android Open Source Project 353f8057104af9cae031b544e971a52adafa7c0d9eThe Android Open Source Project List<ITypeReference> typeArguments = 354f8057104af9cae031b544e971a52adafa7c0d9eThe Android Open Source Project new LinkedList<ITypeReference>(); 355f8057104af9cae031b544e971a52adafa7c0d9eThe Android Open Source Project for (Type typeArgument : pType.typeArguments()) { 356f8057104af9cae031b544e971a52adafa7c0d9eThe Android Open Source Project typeArguments.add(convertTypeReference(typeArgument)); 357f8057104af9cae031b544e971a52adafa7c0d9eThe Android Open Source Project } 358f8057104af9cae031b544e971a52adafa7c0d9eThe Android Open Source Project 359f8057104af9cae031b544e971a52adafa7c0d9eThe Android Open Source Project if (typeArguments.size() > 0) { 360f8057104af9cae031b544e971a52adafa7c0d9eThe Android Open Source Project return pool.getParameterizedType(ownerType, rawType, 361f8057104af9cae031b544e971a52adafa7c0d9eThe Android Open Source Project typeArguments); 362f8057104af9cae031b544e971a52adafa7c0d9eThe Android Open Source Project } else { 363f8057104af9cae031b544e971a52adafa7c0d9eThe Android Open Source Project return rawType; 364f8057104af9cae031b544e971a52adafa7c0d9eThe Android Open Source Project } 365f8057104af9cae031b544e971a52adafa7c0d9eThe Android Open Source Project } 366f8057104af9cae031b544e971a52adafa7c0d9eThe Android Open Source Project 367f8057104af9cae031b544e971a52adafa7c0d9eThe Android Open Source Project TypeVariable tv = type.asTypeVariable(); 368f8057104af9cae031b544e971a52adafa7c0d9eThe Android Open Source Project if (tv != null) { 369f8057104af9cae031b544e971a52adafa7c0d9eThe Android Open Source Project String name = tv.typeName(); 370f8057104af9cae031b544e971a52adafa7c0d9eThe Android Open Source Project 371f8057104af9cae031b544e971a52adafa7c0d9eThe Android Open Source Project if (currentTypeVariableDefinition != null 372f8057104af9cae031b544e971a52adafa7c0d9eThe Android Open Source Project && name.equals(currentTypeVariableDefinition.getName())) 373f8057104af9cae031b544e971a52adafa7c0d9eThe Android Open Source Project return new SigTypeVariableReference( 374f8057104af9cae031b544e971a52adafa7c0d9eThe Android Open Source Project currentTypeVariableDefinition); 375f8057104af9cae031b544e971a52adafa7c0d9eThe Android Open Source Project 376f8057104af9cae031b544e971a52adafa7c0d9eThe Android Open Source Project IGenericDeclaration genericDeclaration = null; 377f8057104af9cae031b544e971a52adafa7c0d9eThe Android Open Source Project ProgramElementDoc programElement = tv.owner(); 378f8057104af9cae031b544e971a52adafa7c0d9eThe Android Open Source Project if (programElement instanceof ClassDoc) { 379f8057104af9cae031b544e971a52adafa7c0d9eThe Android Open Source Project genericDeclaration = convertClass((ClassDoc) programElement); 380f8057104af9cae031b544e971a52adafa7c0d9eThe Android Open Source Project } else if (programElement instanceof MethodDoc 381f8057104af9cae031b544e971a52adafa7c0d9eThe Android Open Source Project && currentMethod.size() > 0) { 382f8057104af9cae031b544e971a52adafa7c0d9eThe Android Open Source Project genericDeclaration = currentMethod.peek(); 383f8057104af9cae031b544e971a52adafa7c0d9eThe Android Open Source Project } else if (programElement instanceof ConstructorDoc 384f8057104af9cae031b544e971a52adafa7c0d9eThe Android Open Source Project && currentConstructor.size() > 0) { 385f8057104af9cae031b544e971a52adafa7c0d9eThe Android Open Source Project genericDeclaration = currentConstructor.peek(); 386f8057104af9cae031b544e971a52adafa7c0d9eThe Android Open Source Project } else { 387f8057104af9cae031b544e971a52adafa7c0d9eThe Android Open Source Project throw new IllegalStateException("situation not expected"); 388f8057104af9cae031b544e971a52adafa7c0d9eThe Android Open Source Project } 389f8057104af9cae031b544e971a52adafa7c0d9eThe Android Open Source Project SigTypeVariableDefinition typeVariable = pool.getTypeVariable(name, 390f8057104af9cae031b544e971a52adafa7c0d9eThe Android Open Source Project genericDeclaration); 391f8057104af9cae031b544e971a52adafa7c0d9eThe Android Open Source Project 392f8057104af9cae031b544e971a52adafa7c0d9eThe Android Open Source Project List<ITypeReference> upperBounds = new LinkedList<ITypeReference>(); 393f8057104af9cae031b544e971a52adafa7c0d9eThe Android Open Source Project for (Type upperBound : tv.bounds()) { 394f8057104af9cae031b544e971a52adafa7c0d9eThe Android Open Source Project // we are converting a type variable declaration which is stored 395f8057104af9cae031b544e971a52adafa7c0d9eThe Android Open Source Project // in the 396f8057104af9cae031b544e971a52adafa7c0d9eThe Android Open Source Project // field currentTypeVariableDefinition 397f8057104af9cae031b544e971a52adafa7c0d9eThe Android Open Source Project assert currentTypeVariableDefinition == null; 398f8057104af9cae031b544e971a52adafa7c0d9eThe Android Open Source Project currentTypeVariableDefinition = typeVariable; 399f8057104af9cae031b544e971a52adafa7c0d9eThe Android Open Source Project upperBounds.add(convertTypeReference(upperBound)); 400f8057104af9cae031b544e971a52adafa7c0d9eThe Android Open Source Project currentTypeVariableDefinition = null; 401f8057104af9cae031b544e971a52adafa7c0d9eThe Android Open Source Project } 402f8057104af9cae031b544e971a52adafa7c0d9eThe Android Open Source Project if (upperBounds.size() == 0) { 403f8057104af9cae031b544e971a52adafa7c0d9eThe Android Open Source Project // no explicit bounds, use java.lang.Object 404f8057104af9cae031b544e971a52adafa7c0d9eThe Android Open Source Project upperBounds.add(pool.getClassReference("java.lang", "Object")); 405f8057104af9cae031b544e971a52adafa7c0d9eThe Android Open Source Project } 406f8057104af9cae031b544e971a52adafa7c0d9eThe Android Open Source Project typeVariable.setUpperBounds(upperBounds); 407f8057104af9cae031b544e971a52adafa7c0d9eThe Android Open Source Project 408f8057104af9cae031b544e971a52adafa7c0d9eThe Android Open Source Project return new SigTypeVariableReference(typeVariable); 409f8057104af9cae031b544e971a52adafa7c0d9eThe Android Open Source Project } 410f8057104af9cae031b544e971a52adafa7c0d9eThe Android Open Source Project 411f8057104af9cae031b544e971a52adafa7c0d9eThe Android Open Source Project WildcardType wt = type.asWildcardType(); 412f8057104af9cae031b544e971a52adafa7c0d9eThe Android Open Source Project if (wt != null) { 413f8057104af9cae031b544e971a52adafa7c0d9eThe Android Open Source Project ITypeReference lowerBound = null; 414f8057104af9cae031b544e971a52adafa7c0d9eThe Android Open Source Project for (Type superBound : wt.superBounds()) { 415f8057104af9cae031b544e971a52adafa7c0d9eThe Android Open Source Project lowerBound = convertTypeReference(superBound); 416f8057104af9cae031b544e971a52adafa7c0d9eThe Android Open Source Project } 417f8057104af9cae031b544e971a52adafa7c0d9eThe Android Open Source Project 418f8057104af9cae031b544e971a52adafa7c0d9eThe Android Open Source Project List<ITypeReference> upperBounds = new LinkedList<ITypeReference>(); 419f8057104af9cae031b544e971a52adafa7c0d9eThe Android Open Source Project for (Type upperBound : wt.extendsBounds()) { 420f8057104af9cae031b544e971a52adafa7c0d9eThe Android Open Source Project upperBounds.add(convertTypeReference(upperBound)); 421f8057104af9cae031b544e971a52adafa7c0d9eThe Android Open Source Project } 422f8057104af9cae031b544e971a52adafa7c0d9eThe Android Open Source Project if (upperBounds.size() == 0) { 423f8057104af9cae031b544e971a52adafa7c0d9eThe Android Open Source Project // no explicit bounds, use java.lang.Object 424f8057104af9cae031b544e971a52adafa7c0d9eThe Android Open Source Project upperBounds.add(pool.getClassReference("java.lang", "Object")); 425f8057104af9cae031b544e971a52adafa7c0d9eThe Android Open Source Project } 426f8057104af9cae031b544e971a52adafa7c0d9eThe Android Open Source Project 427f8057104af9cae031b544e971a52adafa7c0d9eThe Android Open Source Project return pool.getWildcardType(lowerBound, upperBounds); 428f8057104af9cae031b544e971a52adafa7c0d9eThe Android Open Source Project } 429f8057104af9cae031b544e971a52adafa7c0d9eThe Android Open Source Project 430f8057104af9cae031b544e971a52adafa7c0d9eThe Android Open Source Project ClassDoc c = type.asClassDoc(); 431f8057104af9cae031b544e971a52adafa7c0d9eThe Android Open Source Project if (c != null) { 432f8057104af9cae031b544e971a52adafa7c0d9eThe Android Open Source Project return new SigClassReference(convertClass(c)); 433f8057104af9cae031b544e971a52adafa7c0d9eThe Android Open Source Project } 434f8057104af9cae031b544e971a52adafa7c0d9eThe Android Open Source Project 435f8057104af9cae031b544e971a52adafa7c0d9eThe Android Open Source Project if (type.isPrimitive()) { 436f8057104af9cae031b544e971a52adafa7c0d9eThe Android Open Source Project return SigPrimitiveType.valueOfTypeName(type.typeName()); 437f8057104af9cae031b544e971a52adafa7c0d9eThe Android Open Source Project } 438f8057104af9cae031b544e971a52adafa7c0d9eThe Android Open Source Project 439f8057104af9cae031b544e971a52adafa7c0d9eThe Android Open Source Project throw new IllegalStateException(type.toString()); 440f8057104af9cae031b544e971a52adafa7c0d9eThe Android Open Source Project } 441f8057104af9cae031b544e971a52adafa7c0d9eThe Android Open Source Project 442f8057104af9cae031b544e971a52adafa7c0d9eThe Android Open Source Project private void convertExecutableMember(ExecutableMemberDoc member, 443f8057104af9cae031b544e971a52adafa7c0d9eThe Android Open Source Project SigExecutableMember m) { 444f8057104af9cae031b544e971a52adafa7c0d9eThe Android Open Source Project Set<Modifier> modifiers = convertModifiers(member.modifierSpecifier()); 445f8057104af9cae031b544e971a52adafa7c0d9eThe Android Open Source Project 446f8057104af9cae031b544e971a52adafa7c0d9eThe Android Open Source Project // Doclet Bug: final values method is not considered as final 447f8057104af9cae031b544e971a52adafa7c0d9eThe Android Open Source Project if (member.containingClass().isEnum() && member.name().equals("values") 448f8057104af9cae031b544e971a52adafa7c0d9eThe Android Open Source Project && member.parameters().length == 0) { 449f8057104af9cae031b544e971a52adafa7c0d9eThe Android Open Source Project modifiers.add(Modifier.FINAL); 450f8057104af9cae031b544e971a52adafa7c0d9eThe Android Open Source Project } 451f8057104af9cae031b544e971a52adafa7c0d9eThe Android Open Source Project 452f8057104af9cae031b544e971a52adafa7c0d9eThe Android Open Source Project if (member.containingClass().isInterface()) { 453f8057104af9cae031b544e971a52adafa7c0d9eThe Android Open Source Project modifiers.add(Modifier.ABSTRACT); 454f8057104af9cae031b544e971a52adafa7c0d9eThe Android Open Source Project } 455f8057104af9cae031b544e971a52adafa7c0d9eThe Android Open Source Project 456f8057104af9cae031b544e971a52adafa7c0d9eThe Android Open Source Project m.setModifiers(modifiers); 457f8057104af9cae031b544e971a52adafa7c0d9eThe Android Open Source Project m.setAnnotations(convertAnnotations(member.annotations())); 458f8057104af9cae031b544e971a52adafa7c0d9eThe Android Open Source Project m.setDeclaringClass(convertClass(member.containingClass())); 459f8057104af9cae031b544e971a52adafa7c0d9eThe Android Open Source Project 460f8057104af9cae031b544e971a52adafa7c0d9eThe Android Open Source Project List<ITypeVariableDefinition> typeParameters = 461f8057104af9cae031b544e971a52adafa7c0d9eThe Android Open Source Project new LinkedList<ITypeVariableDefinition>(); 462f8057104af9cae031b544e971a52adafa7c0d9eThe Android Open Source Project for (TypeVariable typeParameter : member.typeParameters()) { 463f8057104af9cae031b544e971a52adafa7c0d9eThe Android Open Source Project String name = typeParameter.typeName(); 464f8057104af9cae031b544e971a52adafa7c0d9eThe Android Open Source Project IGenericDeclaration genericDeclaration = null; 465f8057104af9cae031b544e971a52adafa7c0d9eThe Android Open Source Project if (currentMethod.size() > 0) 466f8057104af9cae031b544e971a52adafa7c0d9eThe Android Open Source Project genericDeclaration = currentMethod.peek(); 467f8057104af9cae031b544e971a52adafa7c0d9eThe Android Open Source Project else if (currentConstructor.size() > 0) 468f8057104af9cae031b544e971a52adafa7c0d9eThe Android Open Source Project genericDeclaration = currentConstructor.peek(); 469f8057104af9cae031b544e971a52adafa7c0d9eThe Android Open Source Project else 470f8057104af9cae031b544e971a52adafa7c0d9eThe Android Open Source Project throw new RuntimeException(); 471f8057104af9cae031b544e971a52adafa7c0d9eThe Android Open Source Project SigTypeVariableDefinition p = pool.getTypeVariable(name, 472f8057104af9cae031b544e971a52adafa7c0d9eThe Android Open Source Project genericDeclaration); 473f8057104af9cae031b544e971a52adafa7c0d9eThe Android Open Source Project 474f8057104af9cae031b544e971a52adafa7c0d9eThe Android Open Source Project List<ITypeReference> upperBounds = new LinkedList<ITypeReference>(); 475f8057104af9cae031b544e971a52adafa7c0d9eThe Android Open Source Project for (Type u : typeParameter.bounds()) { 476f8057104af9cae031b544e971a52adafa7c0d9eThe Android Open Source Project upperBounds.add(convertTypeReference(u)); 477f8057104af9cae031b544e971a52adafa7c0d9eThe Android Open Source Project } 478f8057104af9cae031b544e971a52adafa7c0d9eThe Android Open Source Project p.setUpperBounds(upperBounds); 479f8057104af9cae031b544e971a52adafa7c0d9eThe Android Open Source Project typeParameters.add(p); 480f8057104af9cae031b544e971a52adafa7c0d9eThe Android Open Source Project } 481f8057104af9cae031b544e971a52adafa7c0d9eThe Android Open Source Project m.setTypeParameters(typeParameters); 482f8057104af9cae031b544e971a52adafa7c0d9eThe Android Open Source Project 483f8057104af9cae031b544e971a52adafa7c0d9eThe Android Open Source Project List<IParameter> parameters = new LinkedList<IParameter>(); 484f8057104af9cae031b544e971a52adafa7c0d9eThe Android Open Source Project for (Parameter parameter : member.parameters()) { 485f8057104af9cae031b544e971a52adafa7c0d9eThe Android Open Source Project SigParameter p = new SigParameter(convertTypeReference(parameter 486f8057104af9cae031b544e971a52adafa7c0d9eThe Android Open Source Project .type())); 487f8057104af9cae031b544e971a52adafa7c0d9eThe Android Open Source Project p.setAnnotations(convertAnnotations(parameter.annotations())); 488f8057104af9cae031b544e971a52adafa7c0d9eThe Android Open Source Project parameters.add(p); 489f8057104af9cae031b544e971a52adafa7c0d9eThe Android Open Source Project } 490f8057104af9cae031b544e971a52adafa7c0d9eThe Android Open Source Project m.setParameters(parameters); 491f8057104af9cae031b544e971a52adafa7c0d9eThe Android Open Source Project 492f8057104af9cae031b544e971a52adafa7c0d9eThe Android Open Source Project Set<ITypeReference> exceptions = new HashSet<ITypeReference>(); 493f8057104af9cae031b544e971a52adafa7c0d9eThe Android Open Source Project for (Type exceptionType : member.thrownExceptionTypes()) { 494f8057104af9cae031b544e971a52adafa7c0d9eThe Android Open Source Project exceptions.add(convertTypeReference(exceptionType)); 495f8057104af9cae031b544e971a52adafa7c0d9eThe Android Open Source Project } 496f8057104af9cae031b544e971a52adafa7c0d9eThe Android Open Source Project m.setExceptions(exceptions); 497f8057104af9cae031b544e971a52adafa7c0d9eThe Android Open Source Project } 498f8057104af9cae031b544e971a52adafa7c0d9eThe Android Open Source Project 499f8057104af9cae031b544e971a52adafa7c0d9eThe Android Open Source Project private Stack<SigMethod> currentMethod = new Stack<SigMethod>(); 500f8057104af9cae031b544e971a52adafa7c0d9eThe Android Open Source Project 501f8057104af9cae031b544e971a52adafa7c0d9eThe Android Open Source Project private IMethod convertMethod(MethodDoc method) { 502f8057104af9cae031b544e971a52adafa7c0d9eThe Android Open Source Project SigMethod m = new SigMethod(method.name()); 503f8057104af9cae031b544e971a52adafa7c0d9eThe Android Open Source Project currentMethod.push(m); 504f8057104af9cae031b544e971a52adafa7c0d9eThe Android Open Source Project convertExecutableMember(method, m); 505f8057104af9cae031b544e971a52adafa7c0d9eThe Android Open Source Project m.setReturnType(convertTypeReference(method.returnType())); 506f8057104af9cae031b544e971a52adafa7c0d9eThe Android Open Source Project currentMethod.pop(); 507f8057104af9cae031b544e971a52adafa7c0d9eThe Android Open Source Project return m; 508f8057104af9cae031b544e971a52adafa7c0d9eThe Android Open Source Project } 509f8057104af9cae031b544e971a52adafa7c0d9eThe Android Open Source Project 510f8057104af9cae031b544e971a52adafa7c0d9eThe Android Open Source Project private Stack<SigConstructor> currentConstructor = 511f8057104af9cae031b544e971a52adafa7c0d9eThe Android Open Source Project new Stack<SigConstructor>(); 512f8057104af9cae031b544e971a52adafa7c0d9eThe Android Open Source Project 513f8057104af9cae031b544e971a52adafa7c0d9eThe Android Open Source Project private IConstructor convertConstructor(ConstructorDoc constructor) { 514f8057104af9cae031b544e971a52adafa7c0d9eThe Android Open Source Project SigConstructor c = new SigConstructor(constructor.name()); 515f8057104af9cae031b544e971a52adafa7c0d9eThe Android Open Source Project currentConstructor.push(c); 516f8057104af9cae031b544e971a52adafa7c0d9eThe Android Open Source Project convertExecutableMember(constructor, c); 517f8057104af9cae031b544e971a52adafa7c0d9eThe Android Open Source Project currentConstructor.pop(); 518f8057104af9cae031b544e971a52adafa7c0d9eThe Android Open Source Project return c; 519f8057104af9cae031b544e971a52adafa7c0d9eThe Android Open Source Project } 520f8057104af9cae031b544e971a52adafa7c0d9eThe Android Open Source Project 521f8057104af9cae031b544e971a52adafa7c0d9eThe Android Open Source Project private IField convertField(FieldDoc field) { 522f8057104af9cae031b544e971a52adafa7c0d9eThe Android Open Source Project SigField f = new SigField(field.name()); 523f8057104af9cae031b544e971a52adafa7c0d9eThe Android Open Source Project f.setAnnotations(convertAnnotations(field.annotations())); 524f8057104af9cae031b544e971a52adafa7c0d9eThe Android Open Source Project f.setModifiers(convertModifiers(field.modifierSpecifier())); 525f8057104af9cae031b544e971a52adafa7c0d9eThe Android Open Source Project f.setType(convertTypeReference(field.type())); 526f8057104af9cae031b544e971a52adafa7c0d9eThe Android Open Source Project return f; 527f8057104af9cae031b544e971a52adafa7c0d9eThe Android Open Source Project } 528f8057104af9cae031b544e971a52adafa7c0d9eThe Android Open Source Project 529f8057104af9cae031b544e971a52adafa7c0d9eThe Android Open Source Project private IEnumConstant convertEnumConstant(FieldDoc enumConstant, 530f8057104af9cae031b544e971a52adafa7c0d9eThe Android Open Source Project int ordinal) { 531f8057104af9cae031b544e971a52adafa7c0d9eThe Android Open Source Project SigEnumConstant ec = new SigEnumConstant(enumConstant.name()); 532f8057104af9cae031b544e971a52adafa7c0d9eThe Android Open Source Project ec.setOrdinal(ordinal); 533f8057104af9cae031b544e971a52adafa7c0d9eThe Android Open Source Project ec.setAnnotations(convertAnnotations(enumConstant.annotations())); 534f8057104af9cae031b544e971a52adafa7c0d9eThe Android Open Source Project ec.setModifiers(convertModifiers(enumConstant.modifierSpecifier())); 535f8057104af9cae031b544e971a52adafa7c0d9eThe Android Open Source Project ec.setType(convertTypeReference(enumConstant.type())); 536f8057104af9cae031b544e971a52adafa7c0d9eThe Android Open Source Project return ec; 537f8057104af9cae031b544e971a52adafa7c0d9eThe Android Open Source Project } 538f8057104af9cae031b544e971a52adafa7c0d9eThe Android Open Source Project 539f8057104af9cae031b544e971a52adafa7c0d9eThe Android Open Source Project private Set<IAnnotation> convertAnnotations( 540f8057104af9cae031b544e971a52adafa7c0d9eThe Android Open Source Project AnnotationDesc[] annotationDescs) { 541f8057104af9cae031b544e971a52adafa7c0d9eThe Android Open Source Project Set<IAnnotation> annotations = new HashSet<IAnnotation>(); 542f8057104af9cae031b544e971a52adafa7c0d9eThe Android Open Source Project for (AnnotationDesc annotationDesc : annotationDescs) { 543f8057104af9cae031b544e971a52adafa7c0d9eThe Android Open Source Project if (!annotationRetentionIsSource(annotationDesc)) 544f8057104af9cae031b544e971a52adafa7c0d9eThe Android Open Source Project annotations.add(convertAnnotation(annotationDesc)); 545f8057104af9cae031b544e971a52adafa7c0d9eThe Android Open Source Project } 546f8057104af9cae031b544e971a52adafa7c0d9eThe Android Open Source Project return annotations; 547f8057104af9cae031b544e971a52adafa7c0d9eThe Android Open Source Project } 548f8057104af9cae031b544e971a52adafa7c0d9eThe Android Open Source Project 549f8057104af9cae031b544e971a52adafa7c0d9eThe Android Open Source Project private boolean annotationRetentionIsSource(AnnotationDesc annotationDesc) { 550f8057104af9cae031b544e971a52adafa7c0d9eThe Android Open Source Project AnnotationTypeDoc type = annotationDesc.annotationType(); 551f8057104af9cae031b544e971a52adafa7c0d9eThe Android Open Source Project AnnotationDesc[] annotations = type.annotations(); 552f8057104af9cae031b544e971a52adafa7c0d9eThe Android Open Source Project for (AnnotationDesc d : annotations) { 553f8057104af9cae031b544e971a52adafa7c0d9eThe Android Open Source Project if ("java.lang.annotation.Retention".equals(d.annotationType() 554f8057104af9cae031b544e971a52adafa7c0d9eThe Android Open Source Project .qualifiedName())) { 555f8057104af9cae031b544e971a52adafa7c0d9eThe Android Open Source Project for (ElementValuePair value : d.elementValues()) { 556f8057104af9cae031b544e971a52adafa7c0d9eThe Android Open Source Project if ("value".equals(value.element().name())) { 557f8057104af9cae031b544e971a52adafa7c0d9eThe Android Open Source Project return "java.lang.annotation.RetentionPolicy.SOURCE" 558f8057104af9cae031b544e971a52adafa7c0d9eThe Android Open Source Project .equals(value.value().value().toString()); 559f8057104af9cae031b544e971a52adafa7c0d9eThe Android Open Source Project } 560f8057104af9cae031b544e971a52adafa7c0d9eThe Android Open Source Project } 561f8057104af9cae031b544e971a52adafa7c0d9eThe Android Open Source Project } 562f8057104af9cae031b544e971a52adafa7c0d9eThe Android Open Source Project } 563f8057104af9cae031b544e971a52adafa7c0d9eThe Android Open Source Project // default retention policy is CLASS 564f8057104af9cae031b544e971a52adafa7c0d9eThe Android Open Source Project return false; 565f8057104af9cae031b544e971a52adafa7c0d9eThe Android Open Source Project } 566f8057104af9cae031b544e971a52adafa7c0d9eThe Android Open Source Project 567f8057104af9cae031b544e971a52adafa7c0d9eThe Android Open Source Project private IAnnotation convertAnnotation(AnnotationDesc annotationDesc) { 568f8057104af9cae031b544e971a52adafa7c0d9eThe Android Open Source Project SigAnnotation a = new SigAnnotation(); 569f8057104af9cae031b544e971a52adafa7c0d9eThe Android Open Source Project 570f8057104af9cae031b544e971a52adafa7c0d9eThe Android Open Source Project IClassReference annotationType = (IClassReference) convertTypeReference( 571f8057104af9cae031b544e971a52adafa7c0d9eThe Android Open Source Project annotationDesc.annotationType()); 572f8057104af9cae031b544e971a52adafa7c0d9eThe Android Open Source Project a.setType(annotationType); 573f8057104af9cae031b544e971a52adafa7c0d9eThe Android Open Source Project 574f8057104af9cae031b544e971a52adafa7c0d9eThe Android Open Source Project Set<IAnnotationElement> elements = new HashSet<IAnnotationElement>(); 575f8057104af9cae031b544e971a52adafa7c0d9eThe Android Open Source Project for (AnnotationDesc.ElementValuePair pair : annotationDesc 576f8057104af9cae031b544e971a52adafa7c0d9eThe Android Open Source Project .elementValues()) { 577f8057104af9cae031b544e971a52adafa7c0d9eThe Android Open Source Project SigAnnotationElement element = new SigAnnotationElement(); 578f8057104af9cae031b544e971a52adafa7c0d9eThe Android Open Source Project elements.add(element); 579f8057104af9cae031b544e971a52adafa7c0d9eThe Android Open Source Project 580f8057104af9cae031b544e971a52adafa7c0d9eThe Android Open Source Project element.setValue(convertAnnotationValue(pair.value())); 581f8057104af9cae031b544e971a52adafa7c0d9eThe Android Open Source Project String name = pair.element().name(); 582f8057104af9cae031b544e971a52adafa7c0d9eThe Android Open Source Project for (IAnnotationField field : annotationType.getClassDefinition() 583f8057104af9cae031b544e971a52adafa7c0d9eThe Android Open Source Project .getAnnotationFields()) { 584f8057104af9cae031b544e971a52adafa7c0d9eThe Android Open Source Project if (field.getName().equals(name)) { 585f8057104af9cae031b544e971a52adafa7c0d9eThe Android Open Source Project element.setDeclaringField(field); 586f8057104af9cae031b544e971a52adafa7c0d9eThe Android Open Source Project } 587f8057104af9cae031b544e971a52adafa7c0d9eThe Android Open Source Project } 588f8057104af9cae031b544e971a52adafa7c0d9eThe Android Open Source Project } 589f8057104af9cae031b544e971a52adafa7c0d9eThe Android Open Source Project a.setElements(elements); 590f8057104af9cae031b544e971a52adafa7c0d9eThe Android Open Source Project return a; 591f8057104af9cae031b544e971a52adafa7c0d9eThe Android Open Source Project } 592f8057104af9cae031b544e971a52adafa7c0d9eThe Android Open Source Project 593f8057104af9cae031b544e971a52adafa7c0d9eThe Android Open Source Project private void initializeClass(SigClassDefinition c) { 594f8057104af9cae031b544e971a52adafa7c0d9eThe Android Open Source Project c.setAnnotationFields(null); 595f8057104af9cae031b544e971a52adafa7c0d9eThe Android Open Source Project c.setAnnotations(null); 596f8057104af9cae031b544e971a52adafa7c0d9eThe Android Open Source Project c.setConstructors(null); 597f8057104af9cae031b544e971a52adafa7c0d9eThe Android Open Source Project c.setDeclaringClass(null); 598f8057104af9cae031b544e971a52adafa7c0d9eThe Android Open Source Project c.setEnumConstants(null); 599f8057104af9cae031b544e971a52adafa7c0d9eThe Android Open Source Project c.setFields(null); 600f8057104af9cae031b544e971a52adafa7c0d9eThe Android Open Source Project c.setInnerClasses(null); 601f8057104af9cae031b544e971a52adafa7c0d9eThe Android Open Source Project c.setInterfaces(null); 602f8057104af9cae031b544e971a52adafa7c0d9eThe Android Open Source Project c.setMethods(null); 603f8057104af9cae031b544e971a52adafa7c0d9eThe Android Open Source Project c.setModifiers(null); 604f8057104af9cae031b544e971a52adafa7c0d9eThe Android Open Source Project c.setSuperClass(null); 605f8057104af9cae031b544e971a52adafa7c0d9eThe Android Open Source Project c.setTypeParameters(null); 606f8057104af9cae031b544e971a52adafa7c0d9eThe Android Open Source Project } 607f8057104af9cae031b544e971a52adafa7c0d9eThe Android Open Source Project 608f8057104af9cae031b544e971a52adafa7c0d9eThe Android Open Source Project private Set<Modifier> convertModifiers(int mod) { 609f8057104af9cae031b544e971a52adafa7c0d9eThe Android Open Source Project Set<Modifier> modifiers = EnumSet.noneOf(Modifier.class); 610f8057104af9cae031b544e971a52adafa7c0d9eThe Android Open Source Project if (java.lang.reflect.Modifier.isAbstract(mod)) 611f8057104af9cae031b544e971a52adafa7c0d9eThe Android Open Source Project modifiers.add(Modifier.ABSTRACT); 612f8057104af9cae031b544e971a52adafa7c0d9eThe Android Open Source Project if (java.lang.reflect.Modifier.isFinal(mod)) 613f8057104af9cae031b544e971a52adafa7c0d9eThe Android Open Source Project modifiers.add(Modifier.FINAL); 614f8057104af9cae031b544e971a52adafa7c0d9eThe Android Open Source Project // if (java.lang.reflect.Modifier.isNative(mod)) 615f8057104af9cae031b544e971a52adafa7c0d9eThe Android Open Source Project // modifiers.add(Modifier.NATIVE); 616f8057104af9cae031b544e971a52adafa7c0d9eThe Android Open Source Project if (java.lang.reflect.Modifier.isPrivate(mod)) 617f8057104af9cae031b544e971a52adafa7c0d9eThe Android Open Source Project modifiers.add(Modifier.PRIVATE); 618f8057104af9cae031b544e971a52adafa7c0d9eThe Android Open Source Project if (java.lang.reflect.Modifier.isProtected(mod)) 619f8057104af9cae031b544e971a52adafa7c0d9eThe Android Open Source Project modifiers.add(Modifier.PROTECTED); 620f8057104af9cae031b544e971a52adafa7c0d9eThe Android Open Source Project if (java.lang.reflect.Modifier.isPublic(mod)) 621f8057104af9cae031b544e971a52adafa7c0d9eThe Android Open Source Project modifiers.add(Modifier.PUBLIC); 622f8057104af9cae031b544e971a52adafa7c0d9eThe Android Open Source Project if (java.lang.reflect.Modifier.isStatic(mod)) 623f8057104af9cae031b544e971a52adafa7c0d9eThe Android Open Source Project modifiers.add(Modifier.STATIC); 624f8057104af9cae031b544e971a52adafa7c0d9eThe Android Open Source Project // if (java.lang.reflect.Modifier.isStrict(mod)) 625f8057104af9cae031b544e971a52adafa7c0d9eThe Android Open Source Project // modifiers.add(Modifier.STRICT); 626f8057104af9cae031b544e971a52adafa7c0d9eThe Android Open Source Project // if (java.lang.reflect.Modifier.isSynchronized(mod)) 627f8057104af9cae031b544e971a52adafa7c0d9eThe Android Open Source Project // modifiers.add(Modifier.SYNCHRONIZED); 628f8057104af9cae031b544e971a52adafa7c0d9eThe Android Open Source Project // if (java.lang.reflect.Modifier.isTransient(mod)) 629f8057104af9cae031b544e971a52adafa7c0d9eThe Android Open Source Project // modifiers.add(Modifier.TRANSIENT); 630f8057104af9cae031b544e971a52adafa7c0d9eThe Android Open Source Project if (java.lang.reflect.Modifier.isVolatile(mod)) 631f8057104af9cae031b544e971a52adafa7c0d9eThe Android Open Source Project modifiers.add(Modifier.VOLATILE); 632f8057104af9cae031b544e971a52adafa7c0d9eThe Android Open Source Project 633f8057104af9cae031b544e971a52adafa7c0d9eThe Android Open Source Project return modifiers; 634f8057104af9cae031b544e971a52adafa7c0d9eThe Android Open Source Project } 635f8057104af9cae031b544e971a52adafa7c0d9eThe Android Open Source Project 636f8057104af9cae031b544e971a52adafa7c0d9eThe Android Open Source Project} 637