List of usage examples for org.eclipse.jdt.internal.compiler.ast AbstractMethodDeclaration isClinit
public boolean isClinit()
From source file:com.android.tools.lint.psi.EcjPsiBuilder.java
License:Apache License
private void initializeClassBody(@NonNull EcjPsiClass cls, @NonNull TypeDeclaration declaration) { List<PsiClassInitializer> initializers = null; if (declaration.fields != null) { List<EcjPsiField> fields = Lists.newArrayList(); for (FieldDeclaration field : declaration.fields) { if (field instanceof Initializer) { if (initializers == null) { initializers = Lists.newArrayListWithExpectedSize(4); }/*from www . j av a 2s .c om*/ initializers.add(toClassInitializer(cls, (Initializer) field)); } else //noinspection VariableNotUsedInsideIf if (field.type == null) { fields.add(toEnumConstant(cls, field)); } else { fields.add(toField(cls, field)); } } cls.setFields(fields); } if (declaration.methods != null) { List<EcjPsiMethod> methods = Lists.newArrayList(); for (AbstractMethodDeclaration method : declaration.methods) { if (method.isClinit()) { Clinit clinit = (Clinit) method; if (clinit.statements == null) { continue; } if (initializers == null) { initializers = Lists.newArrayListWithExpectedSize(4); } initializers.add(toClassInitializer(cls, clinit)); } else { EcjPsiMethod psiMethod = toMethod(cls, method); if (psiMethod != null) { methods.add(psiMethod); } // else: default constructor not present in source; we skip those } } cls.setMethods(methods); } if (initializers != null) { cls.setInitializers(initializers); } if (declaration.memberTypes != null && declaration.memberTypes.length > 0) { List<EcjPsiClass> methods = Lists.newArrayList(); for (TypeDeclaration method : declaration.memberTypes) { methods.add(toClass(cls, method)); } cls.setInnerClasses(methods.toArray(new EcjPsiClass[0])); } cls.sortChildren(); }
From source file:com.google.gwt.dev.javac.JavaSourceParser.java
License:Open Source License
/** * Find all methods which have the requested name. * /*from w w w . ja v a 2 s . c o m*/ * <p>{@code <clinit>} is not supported. * @param type JDT type declaration * @param name name of methods to find * @return list of matching methods */ private static List<AbstractMethodDeclaration> findNamedMethods(TypeDeclaration type, String name) { List<AbstractMethodDeclaration> matching = new ArrayList<AbstractMethodDeclaration>(); boolean isCtor = "<init>".equals(name); char[] nameArray = name.toCharArray(); for (AbstractMethodDeclaration method : type.methods) { if ((isCtor && method.isConstructor()) || (!isCtor && !method.isConstructor() && !method.isClinit() && Arrays.equals(method.selector, nameArray))) { matching.add(method); } } return matching; }
From source file:org.eclipse.ajdt.core.parserbridge.AJSourceElementNotifier.java
License:Open Source License
protected void notifySourceElementRequestor(AbstractMethodDeclaration methodDeclaration) { // range check boolean isInRange = initialPosition <= methodDeclaration.declarationSourceStart && eofPosition >= methodDeclaration.declarationSourceEnd; if (methodDeclaration.isClinit()) { this.visitIfNeeded(methodDeclaration); return;//from ww w.j a v a2 s . co m } if (methodDeclaration.isDefaultConstructor()) { if (reportReferenceInfo) { ConstructorDeclaration constructorDeclaration = (ConstructorDeclaration) methodDeclaration; ExplicitConstructorCall constructorCall = constructorDeclaration.constructorCall; if (constructorCall != null) { switch (constructorCall.accessMode) { case ExplicitConstructorCall.This: requestor.acceptConstructorReference(typeNames[nestedTypeIndex - 1], constructorCall.arguments == null ? 0 : constructorCall.arguments.length, constructorCall.sourceStart); break; case ExplicitConstructorCall.Super: case ExplicitConstructorCall.ImplicitSuper: requestor.acceptConstructorReference(superTypeNames[nestedTypeIndex - 1], constructorCall.arguments == null ? 0 : constructorCall.arguments.length, constructorCall.sourceStart); break; } } } return; } char[][] argumentTypes = null; char[][] argumentNames = null; boolean isVarArgs = false; Argument[] arguments = methodDeclaration.arguments; if (arguments != null) { char[][][] argumentTypesAndNames = this.getArguments(arguments); argumentTypes = argumentTypesAndNames[0]; argumentNames = argumentTypesAndNames[1]; isVarArgs = arguments[arguments.length - 1].isVarArgs(); } char[][] thrownExceptionTypes = getThrownExceptions(methodDeclaration); // by default no selector end position int selectorSourceEnd = -1; if (methodDeclaration.isConstructor()) { selectorSourceEnd = this.sourceEnds.get(methodDeclaration); if (isInRange) { int currentModifiers = methodDeclaration.modifiers; if (isVarArgs) currentModifiers |= ClassFileConstants.AccVarargs; // remember deprecation so as to not lose it below boolean deprecated = (currentModifiers & ClassFileConstants.AccDeprecated) != 0 || hasDeprecatedAnnotation(methodDeclaration.annotations); ISourceElementRequestor.MethodInfo methodInfo = new ISourceElementRequestor.MethodInfo(); methodInfo.isConstructor = true; methodInfo.declarationStart = methodDeclaration.declarationSourceStart; methodInfo.modifiers = deprecated ? (currentModifiers & ExtraCompilerModifiers.AccJustFlag) | ClassFileConstants.AccDeprecated : currentModifiers & ExtraCompilerModifiers.AccJustFlag; methodInfo.name = methodDeclaration.selector; methodInfo.nameSourceStart = methodDeclaration.sourceStart; methodInfo.nameSourceEnd = selectorSourceEnd; methodInfo.parameterTypes = argumentTypes; methodInfo.parameterNames = argumentNames; methodInfo.exceptionTypes = thrownExceptionTypes; methodInfo.typeParameters = getTypeParameterInfos(methodDeclaration.typeParameters()); methodInfo.categories = (char[][]) this.nodesToCategories.get(methodDeclaration); methodInfo.annotations = methodDeclaration.annotations; methodInfo.node = methodDeclaration; requestor.enterConstructor(methodInfo); } if (reportReferenceInfo) { ConstructorDeclaration constructorDeclaration = (ConstructorDeclaration) methodDeclaration; ExplicitConstructorCall constructorCall = constructorDeclaration.constructorCall; if (constructorCall != null) { switch (constructorCall.accessMode) { case ExplicitConstructorCall.This: requestor.acceptConstructorReference(typeNames[nestedTypeIndex - 1], constructorCall.arguments == null ? 0 : constructorCall.arguments.length, constructorCall.sourceStart); break; case ExplicitConstructorCall.Super: case ExplicitConstructorCall.ImplicitSuper: requestor.acceptConstructorReference(superTypeNames[nestedTypeIndex - 1], constructorCall.arguments == null ? 0 : constructorCall.arguments.length, constructorCall.sourceStart); break; } } } this.visitIfNeeded(methodDeclaration); if (isInRange) { requestor.exitConstructor(methodDeclaration.declarationSourceEnd); } return; } selectorSourceEnd = this.sourceEnds.get(methodDeclaration); // AspectJ Change Begin // recreate source locations for Pointcuts and Advice org.aspectj.org.eclipse.jdt.internal.compiler.ast.MethodDeclaration ajmDec = new org.aspectj.org.eclipse.jdt.internal.compiler.ast.MethodDeclaration( new org.aspectj.org.eclipse.jdt.internal.compiler.CompilationResult( methodDeclaration.compilationResult.fileName, methodDeclaration.compilationResult.unitIndex, methodDeclaration.compilationResult.totalUnitsKnown, 500)); if (ajmDec instanceof PointcutDeclaration) { selectorSourceEnd = methodDeclaration.sourceStart + methodDeclaration.selector.length - 1; } if (ajmDec instanceof AdviceDeclaration) { selectorSourceEnd = methodDeclaration.sourceStart + ((AdviceDeclaration) ajmDec).kind.getName().length() - 1; } // AspectJ Change End if (isInRange) { int currentModifiers = methodDeclaration.modifiers; if (isVarArgs) currentModifiers |= ClassFileConstants.AccVarargs; // remember deprecation so as to not lose it below boolean deprecated = (currentModifiers & ClassFileConstants.AccDeprecated) != 0 || hasDeprecatedAnnotation(methodDeclaration.annotations); TypeReference returnType = methodDeclaration instanceof MethodDeclaration ? ((MethodDeclaration) methodDeclaration).returnType : null; ISourceElementRequestor.MethodInfo methodInfo = new ISourceElementRequestor.MethodInfo(); methodInfo.isAnnotation = methodDeclaration instanceof AnnotationMethodDeclaration; methodInfo.declarationStart = methodDeclaration.declarationSourceStart; methodInfo.modifiers = deprecated ? (currentModifiers & ExtraCompilerModifiers.AccJustFlag) | ClassFileConstants.AccDeprecated : currentModifiers & ExtraCompilerModifiers.AccJustFlag; methodInfo.returnType = returnType == null ? null : CharOperation.concatWith(returnType.getParameterizedTypeName(), '.'); methodInfo.name = methodDeclaration.selector; methodInfo.nameSourceStart = methodDeclaration.sourceStart; methodInfo.nameSourceEnd = selectorSourceEnd; methodInfo.parameterTypes = argumentTypes; methodInfo.parameterNames = argumentNames; methodInfo.exceptionTypes = thrownExceptionTypes; methodInfo.typeParameters = getTypeParameterInfos(methodDeclaration.typeParameters()); methodInfo.categories = (char[][]) this.nodesToCategories.get(methodDeclaration); methodInfo.annotations = methodDeclaration.annotations; methodInfo.node = methodDeclaration; requestor.enterMethod(methodInfo); } this.visitIfNeeded(methodDeclaration); if (isInRange) { if (methodDeclaration instanceof AnnotationMethodDeclaration) { AnnotationMethodDeclaration annotationMethodDeclaration = (AnnotationMethodDeclaration) methodDeclaration; Expression expression = annotationMethodDeclaration.defaultValue; if (expression != null) { requestor.exitMethod(methodDeclaration.declarationSourceEnd, expression); return; } } requestor.exitMethod(methodDeclaration.declarationSourceEnd, (org.aspectj.org.eclipse.jdt.internal.compiler.ast.Expression) null); } }
From source file:org.eclipse.jdt.core.dom.ASTConverter.java
License:Open Source License
protected void buildBodyDeclarations(org.eclipse.jdt.internal.compiler.ast.TypeDeclaration typeDeclaration, AbstractTypeDeclaration typeDecl, boolean isInterface) { // add body declaration in the lexical order org.eclipse.jdt.internal.compiler.ast.TypeDeclaration[] members = typeDeclaration.memberTypes; org.eclipse.jdt.internal.compiler.ast.FieldDeclaration[] fields = typeDeclaration.fields; org.eclipse.jdt.internal.compiler.ast.AbstractMethodDeclaration[] methods = typeDeclaration.methods; int fieldsLength = fields == null ? 0 : fields.length; int methodsLength = methods == null ? 0 : methods.length; int membersLength = members == null ? 0 : members.length; int fieldsIndex = 0; int methodsIndex = 0; int membersIndex = 0; while ((fieldsIndex < fieldsLength) || (membersIndex < membersLength) || (methodsIndex < methodsLength)) { org.eclipse.jdt.internal.compiler.ast.FieldDeclaration nextFieldDeclaration = null; org.eclipse.jdt.internal.compiler.ast.AbstractMethodDeclaration nextMethodDeclaration = null; org.eclipse.jdt.internal.compiler.ast.TypeDeclaration nextMemberDeclaration = null; int position = Integer.MAX_VALUE; int nextDeclarationType = -1; if (fieldsIndex < fieldsLength) { nextFieldDeclaration = fields[fieldsIndex]; if (nextFieldDeclaration.declarationSourceStart < position) { position = nextFieldDeclaration.declarationSourceStart; nextDeclarationType = 0; // FIELD }/*from w w w . j a v a2 s .c om*/ } if (methodsIndex < methodsLength) { nextMethodDeclaration = methods[methodsIndex]; if (nextMethodDeclaration.declarationSourceStart < position) { position = nextMethodDeclaration.declarationSourceStart; nextDeclarationType = 1; // METHOD } } if (membersIndex < membersLength) { nextMemberDeclaration = members[membersIndex]; if (nextMemberDeclaration.declarationSourceStart < position) { position = nextMemberDeclaration.declarationSourceStart; nextDeclarationType = 2; // MEMBER } } switch (nextDeclarationType) { case 0: if (nextFieldDeclaration.getKind() == AbstractVariableDeclaration.ENUM_CONSTANT) { typeDecl.bodyDeclarations().add(convert(nextFieldDeclaration)); } else { checkAndAddMultipleFieldDeclaration(fields, fieldsIndex, typeDecl.bodyDeclarations()); } fieldsIndex++; break; case 1: methodsIndex++; if (!nextMethodDeclaration.isDefaultConstructor() && !nextMethodDeclaration.isClinit()) { // GROOVY start - a little ugly, but allows the conversion of the method declaration // to know if it is occurring within a pure java type or not boolean originalValue = this.scannerUsable; try { this.scannerUsable = typeDeclaration.isScannerUsableOnThisDeclaration(); // GROOVY end typeDecl.bodyDeclarations().add(convert(isInterface, nextMethodDeclaration)); // GROOVY start } finally { this.scannerUsable = originalValue; } // GROOVY end } break; case 2: membersIndex++; ASTNode node = convert(nextMemberDeclaration); if (node == null) { typeDecl.setFlags(typeDecl.getFlags() | ASTNode.MALFORMED); } else { typeDecl.bodyDeclarations().add(node); } } } // Convert javadoc convert(typeDeclaration.javadoc, typeDecl); }
From source file:org.eclipse.jdt.core.dom.ASTConverter.java
License:Open Source License
protected void buildBodyDeclarations(org.eclipse.jdt.internal.compiler.ast.TypeDeclaration enumDeclaration2, EnumDeclaration enumDeclaration) { // add body declaration in the lexical order org.eclipse.jdt.internal.compiler.ast.TypeDeclaration[] members = enumDeclaration2.memberTypes; org.eclipse.jdt.internal.compiler.ast.FieldDeclaration[] fields = enumDeclaration2.fields; org.eclipse.jdt.internal.compiler.ast.AbstractMethodDeclaration[] methods = enumDeclaration2.methods; int fieldsLength = fields == null ? 0 : fields.length; int methodsLength = methods == null ? 0 : methods.length; int membersLength = members == null ? 0 : members.length; int fieldsIndex = 0; int methodsIndex = 0; int membersIndex = 0; while ((fieldsIndex < fieldsLength) || (membersIndex < membersLength) || (methodsIndex < methodsLength)) { org.eclipse.jdt.internal.compiler.ast.FieldDeclaration nextFieldDeclaration = null; org.eclipse.jdt.internal.compiler.ast.AbstractMethodDeclaration nextMethodDeclaration = null; org.eclipse.jdt.internal.compiler.ast.TypeDeclaration nextMemberDeclaration = null; int position = Integer.MAX_VALUE; int nextDeclarationType = -1; if (fieldsIndex < fieldsLength) { nextFieldDeclaration = fields[fieldsIndex]; if (nextFieldDeclaration.declarationSourceStart < position) { position = nextFieldDeclaration.declarationSourceStart; nextDeclarationType = 0; // FIELD }/*from ww w. j av a 2s . co m*/ } if (methodsIndex < methodsLength) { nextMethodDeclaration = methods[methodsIndex]; if (nextMethodDeclaration.declarationSourceStart < position) { position = nextMethodDeclaration.declarationSourceStart; nextDeclarationType = 1; // METHOD } } if (membersIndex < membersLength) { nextMemberDeclaration = members[membersIndex]; if (nextMemberDeclaration.declarationSourceStart < position) { position = nextMemberDeclaration.declarationSourceStart; nextDeclarationType = 2; // MEMBER } } switch (nextDeclarationType) { case 0: if (nextFieldDeclaration.getKind() == AbstractVariableDeclaration.ENUM_CONSTANT) { enumDeclaration.enumConstants().add(convert(nextFieldDeclaration)); } else { checkAndAddMultipleFieldDeclaration(fields, fieldsIndex, enumDeclaration.bodyDeclarations()); } fieldsIndex++; break; case 1: methodsIndex++; if (!nextMethodDeclaration.isDefaultConstructor() && !nextMethodDeclaration.isClinit()) { enumDeclaration.bodyDeclarations().add(convert(false, nextMethodDeclaration)); } break; case 2: membersIndex++; enumDeclaration.bodyDeclarations().add(convert(nextMemberDeclaration)); break; } } convert(enumDeclaration2.javadoc, enumDeclaration); }
From source file:org.eclipse.jdt.core.dom.ASTConverter.java
License:Open Source License
protected void buildBodyDeclarations(org.eclipse.jdt.internal.compiler.ast.TypeDeclaration expression, AnonymousClassDeclaration anonymousClassDeclaration) { // add body declaration in the lexical order org.eclipse.jdt.internal.compiler.ast.TypeDeclaration[] members = expression.memberTypes; org.eclipse.jdt.internal.compiler.ast.FieldDeclaration[] fields = expression.fields; org.eclipse.jdt.internal.compiler.ast.AbstractMethodDeclaration[] methods = expression.methods; int fieldsLength = fields == null ? 0 : fields.length; int methodsLength = methods == null ? 0 : methods.length; int membersLength = members == null ? 0 : members.length; int fieldsIndex = 0; int methodsIndex = 0; int membersIndex = 0; while ((fieldsIndex < fieldsLength) || (membersIndex < membersLength) || (methodsIndex < methodsLength)) { org.eclipse.jdt.internal.compiler.ast.FieldDeclaration nextFieldDeclaration = null; org.eclipse.jdt.internal.compiler.ast.AbstractMethodDeclaration nextMethodDeclaration = null; org.eclipse.jdt.internal.compiler.ast.TypeDeclaration nextMemberDeclaration = null; int position = Integer.MAX_VALUE; int nextDeclarationType = -1; if (fieldsIndex < fieldsLength) { nextFieldDeclaration = fields[fieldsIndex]; if (nextFieldDeclaration.declarationSourceStart < position) { position = nextFieldDeclaration.declarationSourceStart; nextDeclarationType = 0; // FIELD }//from w w w. java 2 s .c o m } if (methodsIndex < methodsLength) { nextMethodDeclaration = methods[methodsIndex]; if (nextMethodDeclaration.declarationSourceStart < position) { position = nextMethodDeclaration.declarationSourceStart; nextDeclarationType = 1; // METHOD } } if (membersIndex < membersLength) { nextMemberDeclaration = members[membersIndex]; if (nextMemberDeclaration.declarationSourceStart < position) { position = nextMemberDeclaration.declarationSourceStart; nextDeclarationType = 2; // MEMBER } } switch (nextDeclarationType) { case 0: if (nextFieldDeclaration.getKind() == AbstractVariableDeclaration.ENUM_CONSTANT) { anonymousClassDeclaration.bodyDeclarations().add(convert(nextFieldDeclaration)); } else { checkAndAddMultipleFieldDeclaration(fields, fieldsIndex, anonymousClassDeclaration.bodyDeclarations()); } fieldsIndex++; break; case 1: methodsIndex++; if (!nextMethodDeclaration.isDefaultConstructor() && !nextMethodDeclaration.isClinit()) { anonymousClassDeclaration.bodyDeclarations().add(convert(false, nextMethodDeclaration)); } break; case 2: membersIndex++; ASTNode node = convert(nextMemberDeclaration); if (node == null) { anonymousClassDeclaration.setFlags(anonymousClassDeclaration.getFlags() | ASTNode.MALFORMED); } else { anonymousClassDeclaration.bodyDeclarations().add(node); } } } }
From source file:org.eclipse.jdt.core.dom.ASTConverter.java
License:Open Source License
public TypeDeclaration convert(org.eclipse.jdt.internal.compiler.ast.ASTNode[] nodes) { final TypeDeclaration typeDecl = new TypeDeclaration(this.ast); typeDecl.setInterface(false);//w ww . ja va 2s . c o m int nodesLength = nodes.length; for (int i = 0; i < nodesLength; i++) { org.eclipse.jdt.internal.compiler.ast.ASTNode node = nodes[i]; if (node instanceof org.eclipse.jdt.internal.compiler.ast.Initializer) { org.eclipse.jdt.internal.compiler.ast.Initializer oldInitializer = (org.eclipse.jdt.internal.compiler.ast.Initializer) node; Initializer initializer = new Initializer(this.ast); initializer.setBody(convert(oldInitializer.block)); setModifiers(initializer, oldInitializer); initializer.setSourceRange(oldInitializer.declarationSourceStart, oldInitializer.sourceEnd - oldInitializer.declarationSourceStart + 1); // setJavaDocComment(initializer); // initializer.setJavadoc(convert(oldInitializer.javadoc)); convert(oldInitializer.javadoc, initializer); typeDecl.bodyDeclarations().add(initializer); } else if (node instanceof org.eclipse.jdt.internal.compiler.ast.FieldDeclaration) { org.eclipse.jdt.internal.compiler.ast.FieldDeclaration fieldDeclaration = (org.eclipse.jdt.internal.compiler.ast.FieldDeclaration) node; if (i > 0 && (nodes[i - 1] instanceof org.eclipse.jdt.internal.compiler.ast.FieldDeclaration) && ((org.eclipse.jdt.internal.compiler.ast.FieldDeclaration) nodes[i - 1]).declarationSourceStart == fieldDeclaration.declarationSourceStart) { // we have a multiple field declaration // We retrieve the existing fieldDeclaration to add the new VariableDeclarationFragment FieldDeclaration currentFieldDeclaration = (FieldDeclaration) typeDecl.bodyDeclarations() .get(typeDecl.bodyDeclarations().size() - 1); currentFieldDeclaration.fragments().add(convertToVariableDeclarationFragment(fieldDeclaration)); } else { // we can create a new FieldDeclaration typeDecl.bodyDeclarations().add(convertToFieldDeclaration(fieldDeclaration)); } } else if (node instanceof org.eclipse.jdt.internal.compiler.ast.AbstractMethodDeclaration) { AbstractMethodDeclaration nextMethodDeclaration = (AbstractMethodDeclaration) node; if (!nextMethodDeclaration.isDefaultConstructor() && !nextMethodDeclaration.isClinit()) { typeDecl.bodyDeclarations().add(convert(false, nextMethodDeclaration)); } } else if (node instanceof org.eclipse.jdt.internal.compiler.ast.TypeDeclaration) { org.eclipse.jdt.internal.compiler.ast.TypeDeclaration nextMemberDeclaration = (org.eclipse.jdt.internal.compiler.ast.TypeDeclaration) node; ASTNode nextMemberDeclarationNode = convert(nextMemberDeclaration); if (nextMemberDeclarationNode == null) { typeDecl.setFlags(typeDecl.getFlags() | ASTNode.MALFORMED); } else { typeDecl.bodyDeclarations().add(nextMemberDeclarationNode); } } } return typeDecl; }
From source file:org.eclipse.objectteams.otdt.internal.core.compiler.statemachine.copyinheritance.CopyInheritance.java
License:Open Source License
/** * Search a method within a role or team declaration. * Does a comparison based on signatures, where the need of signature weakening * is taken into account./*w w w .j a v a 2 s . c o m*/ * @param givenTeam enclosing team of givenMethod * @param givenMethod find a method matching this one's signature * @param targetTeam enclosing team of targetRoleDecl * @param targetClassDecl where to look. * @return the matching method, if any. Might have no binding (i.e. ignoreFurtherInvestigation == true) */ private static AbstractMethodDeclaration findMethod(ReferenceBinding givenTeam, MethodBinding givenMethod, ReferenceBinding targetTeam, TypeDeclaration targetClassDecl) { if (targetClassDecl.methods == null) return null; //Signature-bindings of methods are inserted on demand! targetClassDecl.binding.getMethods(givenMethod.selector); for (int i = 0; i < targetClassDecl.methods.length; i++) { AbstractMethodDeclaration targetMethDecl = targetClassDecl.methods[i]; if (targetMethDecl != null && !targetMethDecl.isClinit()) { if (targetMethDecl.isConstructor() == givenMethod.isConstructor()) { if (!targetMethDecl.isConstructor()) { MethodDeclaration md = (MethodDeclaration) targetMethDecl; // methods - other than constructors - have a name: if (!CharOperation.equals(givenMethod.selector, md.selector)) continue; } if (targetMethDecl.binding == null) return targetMethDecl; if (TypeAnalyzer.isEqualMethodSignature(givenTeam, givenMethod, targetTeam, targetMethDecl.binding, TypeAnalyzer.ANY_MATCH)) { return targetMethDecl; } } } } return null; }
From source file:org.nabucco.framework.mda.model.java.ast.element.JavaAstTypeImpl.java
License:Open Source License
@Override public List<AbstractMethodDeclaration> getMethods(TypeDeclaration type) throws JavaModelException { List<AbstractMethodDeclaration> methodList = new ArrayList<AbstractMethodDeclaration>(); for (AbstractMethodDeclaration method : type.methods) { // No constructors and 'Clint'-methods are delivered. if (method.isConstructor() || method.isClinit()) { continue; }/*from ww w . j a v a2s . c om*/ methodList.add(method); } // Unmodifiable list. return Collections.unmodifiableList(methodList); }