List of usage examples for org.eclipse.jdt.internal.compiler.ast ConstructorDeclaration isAbstract
public boolean isAbstract()
From source file:spoon.support.builder.JDTTreeBuilder.java
License:Open Source License
@SuppressWarnings("unchecked") public boolean visit(ConstructorDeclaration constructorDeclaration, ClassScope scope) { CtConstructor c = factory.Core().createConstructor(); c.setModifiers(getModifier(constructorDeclaration.modifiers)); c.setDocComment(getJavaDoc(constructorDeclaration.javadoc, scope.referenceCompilationUnit())); context.enter(c, constructorDeclaration); if (constructorDeclaration.annotations != null) { int annotationsLength = constructorDeclaration.annotations.length; for (int i = 0; i < annotationsLength; i++) constructorDeclaration.annotations[i].traverse(this, constructorDeclaration.scope); }/* ww w.ja v a 2 s. com*/ context.pushArgument(c); if (constructorDeclaration.arguments != null) { int argumentLength = constructorDeclaration.arguments.length; for (int i = 0; i < argumentLength; i++) constructorDeclaration.arguments[i].traverse(this, constructorDeclaration.scope); } context.popArgument(c); if (constructorDeclaration.thrownExceptions != null) { for (TypeReference r : constructorDeclaration.thrownExceptions) c.getThrownTypes().add(references.getTypeReference(r.resolvedType)); } for (TypeBinding b : constructorDeclaration.binding.typeVariables) { c.getFormalTypeParameters().add(references.getBoundedTypeReference(b)); } // Create block if (!constructorDeclaration.isAbstract()) { CtBlock<?> b = factory.Core().createBlock(); context.enter(b, constructorDeclaration); } if (constructorDeclaration.constructorCall != null) constructorDeclaration.constructorCall.traverse(this, constructorDeclaration.scope); if (constructorDeclaration.statements != null) { for (Statement s : constructorDeclaration.statements) s.traverse(this, constructorDeclaration.scope); } return false; }
From source file:spoon.support.compiler.jdt.JDTTreeBuilder.java
License:Open Source License
@Override public boolean visit(ConstructorDeclaration constructorDeclaration, ClassScope scope) { CtConstructor<?> c = factory.Core().createConstructor(); c.setModifiers(getModifiers(constructorDeclaration.modifiers)); c.setDocComment(getJavaDoc(constructorDeclaration.javadoc, scope.referenceCompilationUnit())); context.enter(c, constructorDeclaration); if (constructorDeclaration.annotations != null) { int annotationsLength = constructorDeclaration.annotations.length; for (int i = 0; i < annotationsLength; i++) { constructorDeclaration.annotations[i].traverse(this, constructorDeclaration.scope); }//from w w w . ja va2 s .co m } context.pushArgument(c); if (constructorDeclaration.arguments != null) { int argumentLength = constructorDeclaration.arguments.length; for (int i = 0; i < argumentLength; i++) { constructorDeclaration.arguments[i].traverse(this, constructorDeclaration.scope); } } context.popArgument(c); if (constructorDeclaration.thrownExceptions != null) { for (TypeReference r : constructorDeclaration.thrownExceptions) { CtTypeReference<? extends Throwable> tr = references.getTypeReference(r.resolvedType); c.addThrownType(tr); } } if (constructorDeclaration.binding != null) { for (TypeBinding b : constructorDeclaration.binding.typeVariables) { c.addFormalTypeParameter(references.getBoundedTypeReference(b)); } } // Create block if (!constructorDeclaration.isAbstract()) { CtBlock<?> b = factory.Core().createBlock(); context.enter(b, constructorDeclaration); } if (constructorDeclaration.constructorCall != null) { constructorDeclaration.constructorCall.traverse(this, constructorDeclaration.scope); } if (constructorDeclaration.statements != null) { for (Statement s : constructorDeclaration.statements) { s.traverse(this, constructorDeclaration.scope); } } return false; }