@Override public void handle(AnnotationValues<Singleton> annotation, Annotation ast, EclipseNode annotationNode) { //remove annotation EclipseHandlerUtil.unboxAndRemoveAnnotationParameter(ast, "onType", "@Singleton(onType=", annotationNode); //add private constructor EclipseNode singletonClass = annotationNode.up(); TypeDeclaration singletonClassType = (TypeDeclaration) singletonClass.get(); ConstructorDeclaration constructor = addConstructor(singletonClass, singletonClassType); TypeReference singletonTypeRef = EclipseHandlerUtil.cloneSelfType(singletonClass, singletonClassType); //add inner class //add instance field StringBuilder sb = new StringBuilder(); sb.append(singletonClass.getName()); sb.append("Holder"); String innerClassName = sb.toString(); TypeDeclaration innerClass = new TypeDeclaration(singletonClassType.compilationResult); innerClass.modifiers = AccPrivate | AccStatic; innerClass.name = innerClassName.toCharArray(); FieldDeclaration instanceVar = addInstanceVar(constructor, singletonTypeRef, innerClass); FieldDeclaration[] declarations = new FieldDeclaration[]{instanceVar}; innerClass.fields = declarations; EclipseHandlerUtil.injectType(singletonClass, innerClass); addFactoryMethod(singletonClass, singletonClassType, singletonTypeRef, innerClass, instanceVar); }
public void createPackageInfoType() { TypeDeclaration declaration = new TypeDeclaration(this.compilationResult); declaration.name = TypeConstants.PACKAGE_INFO_NAME; declaration.modifiers = ClassFileConstants.AccDefault | ClassFileConstants.AccInterface; declaration.javadoc = this.javadoc; this.types[0] = declaration; // Assumes the first slot is meant for this type }
public void createPackageInfoType() { TypeDeclaration declaration = new TypeDeclaration(this.compilationResult); declaration.name = TypeConstants.PACKAGE_INFO_NAME; declaration.modifiers = ClassFileConstants.AccDefault | ClassFileConstants.AccInterface; declaration.javadoc = this.javadoc; this.types[0] = declaration; // Assumes the first slot is meant for this type }
public void createPackageInfoType() { TypeDeclaration declaration = new TypeDeclaration(this.compilationResult); declaration.name = TypeConstants.PACKAGE_INFO_NAME; declaration.modifiers = ClassFileConstants.AccDefault | ClassFileConstants.AccInterface; declaration.javadoc = this.javadoc; this.types[0] = declaration; // Assumes the first slot is meant for this type }
public void createPackageInfoType() { TypeDeclaration declaration = new TypeDeclaration(this.compilationResult); declaration.name = TypeConstants.PACKAGE_INFO_NAME; declaration.modifiers = ClassFileConstants.AccDefault | ClassFileConstants.AccInterface; declaration.javadoc = this.javadoc; this.types[0] = declaration; // Assumes the first slot is meant for this type }
public void createPackageInfoType() { TypeDeclaration declaration = new TypeDeclaration(this.compilationResult); declaration.name = TypeConstants.PACKAGE_INFO_NAME; declaration.modifiers = ClassFileConstants.AccDefault | ClassFileConstants.AccInterface; declaration.javadoc = this.javadoc; this.types[0] = declaration; // Assumes the first slot is meant for this type }
public void createPackageInfoType() { TypeDeclaration declaration = new TypeDeclaration(this.compilationResult); declaration.name = TypeConstants.PACKAGE_INFO_NAME; declaration.modifiers = ClassFileConstants.AccDefault | ClassFileConstants.AccInterface; declaration.javadoc = this.javadoc; this.types[0] = declaration; // Assumes the first slot is meant for this type }
public void createPackageInfoType() { TypeDeclaration declaration = new TypeDeclaration(this.compilationResult); declaration.name = TypeConstants.PACKAGE_INFO_NAME; declaration.modifiers = ClassFileConstants.AccDefault | ClassFileConstants.AccInterface; declaration.javadoc = this.javadoc; this.types[0] = declaration; // Assumes the first slot is meant for this type }
public void createPackageInfoType() { TypeDeclaration declaration = new TypeDeclaration(this.compilationResult); declaration.name = TypeConstants.PACKAGE_INFO_NAME; declaration.modifiers = ClassFileConstants.AccDefault | ClassFileConstants.AccInterface; declaration.javadoc = this.javadoc; this.types[0] = declaration; // Assumes the first slot is meant for this type }
public void createPackageInfoType() { TypeDeclaration declaration = new TypeDeclaration(this.compilationResult); declaration.name = TypeConstants.PACKAGE_INFO_NAME; declaration.modifiers = ClassFileConstants.AccDefault | ClassFileConstants.AccInterface; declaration.javadoc = this.javadoc; this.types[0] = declaration; // Assumes the first slot is meant for this type }
public void createPackageInfoType() { TypeDeclaration declaration = new TypeDeclaration(this.compilationResult); declaration.name = TypeConstants.PACKAGE_INFO_NAME; declaration.modifiers = ClassFileConstants.AccDefault | ClassFileConstants.AccInterface; declaration.javadoc = this.javadoc; this.types[0] = declaration; // Assumes the first slot is meant for this type }
public void createPackageInfoType() { TypeDeclaration declaration = new TypeDeclaration(this.compilationResult); declaration.name = TypeConstants.PACKAGE_INFO_NAME; declaration.modifiers = ClassFileConstants.AccDefault | ClassFileConstants.AccInterface; declaration.javadoc = this.javadoc; this.types[0] = declaration; // Assumes the first slot is meant for this type }
protected void consumeCompilationUnit() { this.javadoc = null; checkComment(); if (this.javadoc != null && this.cursorLocation > this.javadoc.sourceStart && this.cursorLocation < this.javadoc.sourceEnd) { // completion is in an orphan javadoc comment => replace compilation unit one to allow completion resolution this.compilationUnit.javadoc = this.javadoc; // create a fake interface declaration to allow resolution if (this.compilationUnit.types == null) { this.compilationUnit.types = new TypeDeclaration[1]; TypeDeclaration declaration = new TypeDeclaration(this.compilationUnit.compilationResult); declaration.name = FAKE_TYPE_NAME; declaration.modifiers = ClassFileConstants.AccDefault | ClassFileConstants.AccInterface; this.compilationUnit.types[0] = declaration; } } super.consumeCompilationUnit(); } protected void consumeConditionalExpression(int op) {
protected void consumeCompilationUnit() { this.javadoc = null; checkComment(); if (this.javadoc != null && this.cursorLocation > this.javadoc.sourceStart && this.cursorLocation < this.javadoc.sourceEnd) { // completion is in an orphan javadoc comment => replace compilation unit one to allow completion resolution this.compilationUnit.javadoc = this.javadoc; // create a fake interface declaration to allow resolution if (this.compilationUnit.types == null) { this.compilationUnit.types = new TypeDeclaration[1]; TypeDeclaration declaration = new TypeDeclaration(this.compilationUnit.compilationResult); declaration.name = FAKE_TYPE_NAME; declaration.modifiers = ClassFileConstants.AccDefault | ClassFileConstants.AccInterface; this.compilationUnit.types[0] = declaration; } } super.consumeCompilationUnit(); } protected void consumeConditionalExpression(int op) {
protected void consumeCompilationUnit() { this.javadoc = null; checkComment(); if (this.javadoc != null && this.cursorLocation > this.javadoc.sourceStart && this.cursorLocation < this.javadoc.sourceEnd) { // completion is in an orphan javadoc comment => replace compilation unit one to allow completion resolution this.compilationUnit.javadoc = this.javadoc; // create a fake interface declaration to allow resolution if (this.compilationUnit.types == null) { this.compilationUnit.types = new TypeDeclaration[1]; TypeDeclaration declaration = new TypeDeclaration(this.compilationUnit.compilationResult); declaration.name = FAKE_TYPE_NAME; declaration.modifiers = ClassFileConstants.AccDefault | ClassFileConstants.AccInterface; this.compilationUnit.types[0] = declaration; } } super.consumeCompilationUnit(); } protected void consumeConditionalExpression(int op) {
protected void consumeCompilationUnit() { this.javadoc = null; checkComment(); if (this.javadoc != null && this.cursorLocation > this.javadoc.sourceStart && this.cursorLocation < this.javadoc.sourceEnd) { // completion is in an orphan javadoc comment => replace compilation unit one to allow completion resolution this.compilationUnit.javadoc = this.javadoc; // create a fake interface declaration to allow resolution if (this.compilationUnit.types == null) { this.compilationUnit.types = new TypeDeclaration[1]; TypeDeclaration declaration = new TypeDeclaration(this.compilationUnit.compilationResult); declaration.name = FAKE_TYPE_NAME; declaration.modifiers = ClassFileConstants.AccDefault | ClassFileConstants.AccInterface; this.compilationUnit.types[0] = declaration; } } super.consumeCompilationUnit(); } protected void consumeConditionalExpression(int op) {
@Override protected void consumeCompilationUnit() { this.javadoc = null; checkComment(); if (this.javadoc != null && this.cursorLocation > this.javadoc.sourceStart && this.cursorLocation < this.javadoc.sourceEnd) { // completion is in an orphan javadoc comment => replace compilation unit one to allow completion resolution this.compilationUnit.javadoc = this.javadoc; // create a fake interface declaration to allow resolution if (this.compilationUnit.types == null) { this.compilationUnit.types = new TypeDeclaration[1]; TypeDeclaration declaration = new TypeDeclaration(this.compilationUnit.compilationResult); declaration.name = FAKE_TYPE_NAME; declaration.modifiers = ClassFileConstants.AccDefault | ClassFileConstants.AccInterface; this.compilationUnit.types[0] = declaration; } } super.consumeCompilationUnit(); } @Override
protected void consumeCompilationUnit() { this.javadoc = null; checkComment(); if (this.javadoc != null && this.cursorLocation > this.javadoc.sourceStart && this.cursorLocation < this.javadoc.sourceEnd) { // completion is in an orphan javadoc comment => replace compilation unit one to allow completion resolution this.compilationUnit.javadoc = this.javadoc; // create a fake interface declaration to allow resolution if (this.compilationUnit.types == null) { this.compilationUnit.types = new TypeDeclaration[1]; TypeDeclaration declaration = new TypeDeclaration(this.compilationUnit.compilationResult); declaration.name = FAKE_TYPE_NAME; declaration.modifiers = ClassFileConstants.AccDefault | ClassFileConstants.AccInterface; this.compilationUnit.types[0] = declaration; } } super.consumeCompilationUnit(); } protected void consumeConditionalExpression(int op) {
TypeDeclaration anonymousType = new TypeDeclaration(this.compilationUnit.compilationResult); anonymousType.name = CharOperation.NO_CHAR; anonymousType.bits |= (ASTNode.IsAnonymousType|ASTNode.IsLocalType);
TypeDeclaration anonymousType = new TypeDeclaration(this.compilationUnit.compilationResult); anonymousType.name = CharOperation.NO_CHAR; anonymousType.bits |= (ASTNode.IsAnonymousType|ASTNode.IsLocalType);