List of usage examples for org.eclipse.jdt.internal.compiler.classfmt ClassFileConstants AccTransient
int AccTransient
To view the source code for org.eclipse.jdt.internal.compiler.classfmt ClassFileConstants AccTransient.
Click Source Link
From source file:ch.uzh.ifi.seal.changedistiller.ast.java.JavaASTHelper.java
License:Apache License
private boolean isTransient(int ecjModifier) { return (ecjModifier & ClassFileConstants.AccTransient) != 0; }
From source file:lombok.eclipse.handlers.EclipseHandlerUtil.java
License:Open Source License
/** * Given a list of field names and a node referring to a type, finds each name in the list that does not match a field within the type. *///from w w w .ja v a2 s .c o m public static List<Integer> createListOfNonExistentFields(List<String> list, EclipseNode type, boolean excludeStandard, boolean excludeTransient) { boolean[] matched = new boolean[list.size()]; for (EclipseNode child : type.down()) { if (list.isEmpty()) break; if (child.getKind() != Kind.FIELD) continue; if (excludeStandard) { if ((((FieldDeclaration) child.get()).modifiers & ClassFileConstants.AccStatic) != 0) continue; if (child.getName().startsWith("$")) continue; } if (excludeTransient && (((FieldDeclaration) child.get()).modifiers & ClassFileConstants.AccTransient) != 0) continue; int idx = list.indexOf(child.getName()); if (idx > -1) matched[idx] = true; } List<Integer> problematic = new ArrayList<Integer>(); for (int i = 0; i < list.size(); i++) { if (!matched[i]) problematic.add(i); } return problematic; }
From source file:lombok.eclipse.handlers.HandleEqualsAndHashCode.java
License:Open Source License
public void generateMethods(EclipseNode typeNode, EclipseNode errorNode, List<String> excludes, List<String> includes, Boolean callSuper, boolean whineIfExists, FieldAccess fieldAccess, List<Annotation> onParam) { assert excludes == null || includes == null; TypeDeclaration typeDecl = null;/*w ww . j av a 2 s .co m*/ if (typeNode.get() instanceof TypeDeclaration) typeDecl = (TypeDeclaration) typeNode.get(); int modifiers = typeDecl == null ? 0 : typeDecl.modifiers; boolean notAClass = (modifiers & (ClassFileConstants.AccInterface | ClassFileConstants.AccAnnotation | ClassFileConstants.AccEnum)) != 0; if (typeDecl == null || notAClass) { errorNode.addError("@EqualsAndHashCode is only supported on a class."); return; } boolean implicitCallSuper = callSuper == null; if (callSuper == null) { try { callSuper = ((Boolean) EqualsAndHashCode.class.getMethod("callSuper").getDefaultValue()) .booleanValue(); } catch (Exception ignore) { throw new InternalError( "Lombok bug - this cannot happen - can't find callSuper field in EqualsAndHashCode annotation."); } } boolean isDirectDescendantOfObject = true; if (typeDecl.superclass != null) { String p = typeDecl.superclass.toString(); isDirectDescendantOfObject = p.equals("Object") || p.equals("java.lang.Object"); } if (isDirectDescendantOfObject && callSuper) { errorNode.addError("Generating equals/hashCode with a supercall to java.lang.Object is pointless."); return; } if (!isDirectDescendantOfObject && !callSuper && implicitCallSuper) { errorNode.addWarning( "Generating equals/hashCode implementation but without a call to superclass, even though this class does not extend java.lang.Object. If this is intentional, add '@EqualsAndHashCode(callSuper=false)' to your type."); } List<EclipseNode> nodesForEquality = new ArrayList<EclipseNode>(); if (includes != null) { for (EclipseNode child : typeNode.down()) { if (child.getKind() != Kind.FIELD) continue; FieldDeclaration fieldDecl = (FieldDeclaration) child.get(); if (includes.contains(new String(fieldDecl.name))) nodesForEquality.add(child); } } else { for (EclipseNode child : typeNode.down()) { if (child.getKind() != Kind.FIELD) continue; FieldDeclaration fieldDecl = (FieldDeclaration) child.get(); if (!filterField(fieldDecl)) continue; //Skip transient fields. if ((fieldDecl.modifiers & ClassFileConstants.AccTransient) != 0) continue; //Skip excluded fields. if (excludes != null && excludes.contains(new String(fieldDecl.name))) continue; nodesForEquality.add(child); } } boolean isFinal = (typeDecl.modifiers & ClassFileConstants.AccFinal) != 0; boolean needsCanEqual = !isFinal || !isDirectDescendantOfObject; MemberExistsResult equalsExists = methodExists("equals", typeNode, 1); MemberExistsResult hashCodeExists = methodExists("hashCode", typeNode, 0); MemberExistsResult canEqualExists = methodExists("canEqual", typeNode, 1); switch (Collections.max(Arrays.asList(equalsExists, hashCodeExists))) { case EXISTS_BY_LOMBOK: return; case EXISTS_BY_USER: if (whineIfExists) { String msg = "Not generating equals and hashCode: A method with one of those names already exists. (Either both or none of these methods will be generated)."; errorNode.addWarning(msg); } else if (equalsExists == MemberExistsResult.NOT_EXISTS || hashCodeExists == MemberExistsResult.NOT_EXISTS) { // This means equals OR hashCode exists and not both. // Even though we should suppress the message about not generating these, this is such a weird and surprising situation we should ALWAYS generate a warning. // The user code couldn't possibly (barring really weird subclassing shenanigans) be in a shippable state anyway; the implementations of these 2 methods are // all inter-related and should be written by the same entity. String msg = String.format("Not generating %s: One of equals or hashCode exists. " + "You should either write both of these or none of these (in the latter case, lombok generates them).", equalsExists == MemberExistsResult.NOT_EXISTS ? "equals" : "hashCode"); errorNode.addWarning(msg); } return; case NOT_EXISTS: default: //fallthrough } MethodDeclaration equalsMethod = createEquals(typeNode, nodesForEquality, callSuper, errorNode.get(), fieldAccess, needsCanEqual, onParam); equalsMethod.traverse(new SetGeneratedByVisitor(errorNode.get()), ((TypeDeclaration) typeNode.get()).scope); injectMethod(typeNode, equalsMethod); if (needsCanEqual && canEqualExists == MemberExistsResult.NOT_EXISTS) { MethodDeclaration canEqualMethod = createCanEqual(typeNode, errorNode.get(), onParam); canEqualMethod.traverse(new SetGeneratedByVisitor(errorNode.get()), ((TypeDeclaration) typeNode.get()).scope); injectMethod(typeNode, canEqualMethod); } MethodDeclaration hashCodeMethod = createHashCode(typeNode, nodesForEquality, callSuper, errorNode.get(), fieldAccess); hashCodeMethod.traverse(new SetGeneratedByVisitor(errorNode.get()), ((TypeDeclaration) typeNode.get()).scope); injectMethod(typeNode, hashCodeMethod); }
From source file:lombok.eclipse.handlers.PKG.java
License:Open Source License
static List<Integer> createListOfNonExistentFields(List<String> list, EclipseNode type, boolean excludeStandard, boolean excludeTransient) { boolean[] matched = new boolean[list.size()]; for (EclipseNode child : type.down()) { if (list.isEmpty()) break; if (child.getKind() != Kind.FIELD) continue; if (excludeStandard) { if ((((FieldDeclaration) child.get()).modifiers & ClassFileConstants.AccStatic) != 0) continue; if (child.getName().startsWith("$")) continue; }/*from w ww. j a v a 2 s. c o m*/ if (excludeTransient && (((FieldDeclaration) child.get()).modifiers & ClassFileConstants.AccTransient) != 0) continue; int idx = list.indexOf(child.getName()); if (idx > -1) matched[idx] = true; } List<Integer> problematic = new ArrayList<Integer>(); for (int i = 0; i < list.size(); i++) { if (!matched[i]) problematic.add(i); } return problematic; }
From source file:org.codehaus.jdt.groovy.internal.compiler.ast.GroovyCompilationUnitDeclaration.java
License:Open Source License
/** * Create a JDT MethodDeclaration that represents a groovy MethodNode *//* w w w . j a v a 2 s .c o m*/ private MethodDeclaration createMethodDeclaration(ClassNode classNode, MethodNode methodNode, boolean isEnum, CompilationResult compilationResult) { if (classNode.isAnnotationDefinition()) { AnnotationMethodDeclaration methodDeclaration = new AnnotationMethodDeclaration(compilationResult); int modifiers = methodNode.getModifiers(); modifiers &= ~(ClassFileConstants.AccSynthetic | ClassFileConstants.AccTransient); methodDeclaration.annotations = transformAnnotations(methodNode.getAnnotations()); methodDeclaration.modifiers = modifiers; if (methodNode.hasAnnotationDefault()) { methodDeclaration.modifiers |= ClassFileConstants.AccAnnotationDefault; } methodDeclaration.selector = methodNode.getName().toCharArray(); fixupSourceLocationsForMethodDeclaration(methodDeclaration, methodNode); ClassNode returnType = methodNode.getReturnType(); methodDeclaration.returnType = createTypeReferenceForClassNode(returnType); return methodDeclaration; } else { MethodDeclaration methodDeclaration = new MethodDeclaration(compilationResult); // TODO refactor - extract method GenericsType[] generics = methodNode.getGenericsTypes(); // generic method if (generics != null && generics.length != 0) { methodDeclaration.typeParameters = new TypeParameter[generics.length]; for (int tp = 0; tp < generics.length; tp++) { TypeParameter typeParameter = new TypeParameter(); typeParameter.name = generics[tp].getName().toCharArray(); ClassNode[] upperBounds = generics[tp].getUpperBounds(); if (upperBounds != null) { // FIXASC Positional info for these references? typeParameter.type = createTypeReferenceForClassNode(upperBounds[0]); typeParameter.bounds = (upperBounds.length > 1 ? new TypeReference[upperBounds.length - 1] : null); for (int b = 1, max = upperBounds.length; b < max; b++) { typeParameter.bounds[b - 1] = createTypeReferenceForClassNode(upperBounds[b]); typeParameter.bounds[b - 1].bits |= ASTNode.IsSuperType; } } methodDeclaration.typeParameters[tp] = typeParameter; } } boolean isMain = false; // Note: modifiers for the MethodBinding constructed for this declaration will be created marked with // AccVarArgs if the bitset for the type reference in the final argument is marked IsVarArgs int modifiers = methodNode.getModifiers(); modifiers &= ~(ClassFileConstants.AccSynthetic | ClassFileConstants.AccTransient); methodDeclaration.annotations = transformAnnotations(methodNode.getAnnotations()); methodDeclaration.modifiers = modifiers; methodDeclaration.selector = methodNode.getName().toCharArray(); // Need to capture the rule in Verifier.adjustTypesIfStaticMainMethod(MethodNode node) // if (node.getName().equals("main") && node.isStatic()) { // Parameter[] params = node.getParameters(); // if (params.length == 1) { // Parameter param = params[0]; // if (param.getType() == null || param.getType()==ClassHelper.OBJECT_TYPE) { // param.setType(ClassHelper.STRING_TYPE.makeArray()); // ClassNode returnType = node.getReturnType(); // if(returnType == ClassHelper.OBJECT_TYPE) { // node.setReturnType(ClassHelper.VOID_TYPE); // } // } // } Parameter[] params = methodNode.getParameters(); ClassNode returnType = methodNode.getReturnType(); // source of 'static main(args)' would become 'static Object main(Object args)' - so transform here if ((modifiers & ClassFileConstants.AccStatic) != 0 && params != null && params.length == 1 && methodNode.getName().equals("main")) { Parameter p = params[0]; if (p.getType() == null || p.getType().getName().equals(ClassHelper.OBJECT)) { String name = p.getName(); params = new Parameter[1]; params[0] = new Parameter(ClassHelper.STRING_TYPE.makeArray(), name); if (returnType.getName().equals(ClassHelper.OBJECT)) { returnType = ClassHelper.VOID_TYPE; } } } methodDeclaration.arguments = createArguments(params, isMain); methodDeclaration.returnType = createTypeReferenceForClassNode(returnType); methodDeclaration.thrownExceptions = createTypeReferencesForClassNodes(methodNode.getExceptions()); fixupSourceLocationsForMethodDeclaration(methodDeclaration, methodNode); return methodDeclaration; } }
From source file:org.codehaus.jdt.groovy.internal.compiler.ast.GroovyCompilationUnitDeclaration.java
License:Open Source License
/** * Create a JDT representation of a groovy MethodNode - but with some parameters defaulting *///from w w w . j a v a 2 s .c om private MethodDeclaration genMethodDeclarationVariant(MethodNode methodNode, Argument[] alternativeArguments, TypeReference returnType, CompilationResult compilationResult) { MethodDeclaration methodDeclaration = new MethodDeclaration(compilationResult); int modifiers = methodNode.getModifiers(); modifiers &= ~(ClassFileConstants.AccSynthetic | ClassFileConstants.AccTransient); methodDeclaration.annotations = transformAnnotations(methodNode.getAnnotations()); methodDeclaration.modifiers = modifiers; methodDeclaration.selector = methodNode.getName().toCharArray(); methodDeclaration.arguments = alternativeArguments; methodDeclaration.returnType = returnType; fixupSourceLocationsForMethodDeclaration(methodDeclaration, methodNode); return methodDeclaration; }
From source file:org.eclipse.ajdt.core.javaelements.CompilationUnitTools.java
License:Open Source License
public static int getModifierCode(IProgramElement elem) { IProgramElement.Accessibility acc = elem.getAccessibility(); List<Modifiers> others = elem.getModifiers(); int modifiers = 0; if (acc == IProgramElement.Accessibility.PUBLIC) { modifiers |= ClassFileConstants.AccPublic; } else if (acc == IProgramElement.Accessibility.PROTECTED) { modifiers |= ClassFileConstants.AccProtected; } else if (acc == IProgramElement.Accessibility.PRIVATE) { modifiers |= ClassFileConstants.AccPrivate; }/*w w w. ja v a 2s . c o m*/ if (others != null) { if (others.contains(IProgramElement.Modifiers.ABSTRACT)) { modifiers |= ClassFileConstants.AccAbstract; } if (others.contains(IProgramElement.Modifiers.FINAL)) { modifiers |= ClassFileConstants.AccFinal; } if (others.contains(IProgramElement.Modifiers.NATIVE)) { modifiers |= ClassFileConstants.AccNative; } if (others.contains(IProgramElement.Modifiers.STATIC)) { modifiers |= ClassFileConstants.AccStatic; } if (others.contains(IProgramElement.Modifiers.SYNCHRONIZED)) { modifiers |= ClassFileConstants.AccSynchronized; } if (others.contains(IProgramElement.Modifiers.TRANSIENT)) { modifiers |= ClassFileConstants.AccTransient; } if (others.contains(IProgramElement.Modifiers.VOLATILE)) { modifiers |= ClassFileConstants.AccVolatile; } } return modifiers; }
From source file:org.eclipse.ajdt.core.javaelements.CompilationUnitTools.java
License:Open Source License
/** * returns the modifiers of this element as if this element were declared * public// w w w . j a v a 2 s .com */ public static int getPublicModifierCode(IAspectJElementInfo info) { int modifiers = ClassFileConstants.AccPublic; List<Modifiers> others = info.getAJModifiers(); if (others == null) { return modifiers; } if (others.contains(IProgramElement.Modifiers.ABSTRACT)) { modifiers |= ClassFileConstants.AccAbstract; } if (others.contains(IProgramElement.Modifiers.FINAL)) { modifiers |= ClassFileConstants.AccFinal; } if (others.contains(IProgramElement.Modifiers.NATIVE)) { modifiers |= ClassFileConstants.AccNative; } if (others.contains(IProgramElement.Modifiers.STATIC)) { modifiers |= ClassFileConstants.AccStatic; } if (others.contains(IProgramElement.Modifiers.SYNCHRONIZED)) { modifiers |= ClassFileConstants.AccSynchronized; } if (others.contains(IProgramElement.Modifiers.TRANSIENT)) { modifiers |= ClassFileConstants.AccTransient; } if (others.contains(IProgramElement.Modifiers.VOLATILE)) { modifiers |= ClassFileConstants.AccVolatile; } return modifiers; }
From source file:org.eclipse.ajdt.core.javaelements.CompilationUnitTools.java
License:Open Source License
public static List<Modifiers> getModifiersFromModifierCode(int code) { List<Modifiers> mods = new ArrayList<Modifiers>(2); if ((code & ClassFileConstants.AccAbstract) != 0) { mods.add(IProgramElement.Modifiers.ABSTRACT); }/* ww w . j a va 2s. c om*/ if ((code & ClassFileConstants.AccFinal) != 0) { mods.add(IProgramElement.Modifiers.FINAL); } if ((code & ClassFileConstants.AccStatic) != 0) { mods.add(IProgramElement.Modifiers.STATIC); } if ((code & ClassFileConstants.AccVolatile) != 0) { mods.add(IProgramElement.Modifiers.VOLATILE); } if ((code & ClassFileConstants.AccTransient) != 0) { mods.add(IProgramElement.Modifiers.TRANSIENT); } if ((code & ClassFileConstants.AccSynchronized) != 0) { mods.add(IProgramElement.Modifiers.SYNCHRONIZED); } if ((code & ClassFileConstants.AccNative) != 0) { mods.add(IProgramElement.Modifiers.NATIVE); } return mods; }
From source file:org.eclipse.jdt.internal.compiler.parser.Parser.java
License:Open Source License
protected void consumeToken(int type) { /* remember the last consumed value */ /* try to minimize the number of build values */ // // clear the commentPtr of the scanner in case we read something different from a modifier // switch(type) { // case TokenNameabstract : // case TokenNamestrictfp : // case TokenNamefinal : // case TokenNamenative : // case TokenNameprivate : // case TokenNameprotected : // case TokenNamepublic : // case TokenNametransient : // case TokenNamevolatile : // case TokenNamestatic : // case TokenNamesynchronized : // break; // default: // this.scanner.commentPtr = -1; // }//from w w w.j ava2 s.c o m //System.out.println(this.scanner.toStringAction(type)); switch (type) { case TokenNameIdentifier: pushIdentifier(); if (this.scanner.useAssertAsAnIndentifier && this.lastErrorEndPositionBeforeRecovery < this.scanner.currentPosition) { long positions = this.identifierPositionStack[this.identifierPtr]; if (!this.statementRecoveryActivated) problemReporter().useAssertAsAnIdentifier((int) (positions >>> 32), (int) positions); } if (this.scanner.useEnumAsAnIndentifier && this.lastErrorEndPositionBeforeRecovery < this.scanner.currentPosition) { long positions = this.identifierPositionStack[this.identifierPtr]; if (!this.statementRecoveryActivated) problemReporter().useEnumAsAnIdentifier((int) (positions >>> 32), (int) positions); } break; case TokenNameinterface: //'class' is pushing two int (positions) on the stack ==> 'interface' needs to do it too.... pushOnIntStack(this.scanner.currentPosition - 1); pushOnIntStack(this.scanner.startPosition); break; case TokenNameabstract: checkAndSetModifiers(ClassFileConstants.AccAbstract); pushOnExpressionStackLengthStack(0); break; case TokenNamestrictfp: checkAndSetModifiers(ClassFileConstants.AccStrictfp); pushOnExpressionStackLengthStack(0); break; case TokenNamefinal: checkAndSetModifiers(ClassFileConstants.AccFinal); pushOnExpressionStackLengthStack(0); break; case TokenNamenative: checkAndSetModifiers(ClassFileConstants.AccNative); pushOnExpressionStackLengthStack(0); break; case TokenNameprivate: checkAndSetModifiers(ClassFileConstants.AccPrivate); pushOnExpressionStackLengthStack(0); break; case TokenNameprotected: checkAndSetModifiers(ClassFileConstants.AccProtected); pushOnExpressionStackLengthStack(0); break; case TokenNamepublic: checkAndSetModifiers(ClassFileConstants.AccPublic); pushOnExpressionStackLengthStack(0); break; case TokenNametransient: checkAndSetModifiers(ClassFileConstants.AccTransient); pushOnExpressionStackLengthStack(0); break; case TokenNamevolatile: checkAndSetModifiers(ClassFileConstants.AccVolatile); pushOnExpressionStackLengthStack(0); break; case TokenNamestatic: checkAndSetModifiers(ClassFileConstants.AccStatic); pushOnExpressionStackLengthStack(0); break; case TokenNamesynchronized: this.synchronizedBlockSourceStart = this.scanner.startPosition; checkAndSetModifiers(ClassFileConstants.AccSynchronized); pushOnExpressionStackLengthStack(0); break; //============================== case TokenNamevoid: pushIdentifier(-T_void); pushOnIntStack(this.scanner.currentPosition - 1); pushOnIntStack(this.scanner.startPosition); break; //push a default dimension while void is not part of the primitive //declaration baseType and so takes the place of a type without getting into //regular type parsing that generates a dimension on this.intStack case TokenNameboolean: pushIdentifier(-T_boolean); pushOnIntStack(this.scanner.currentPosition - 1); pushOnIntStack(this.scanner.startPosition); break; case TokenNamebyte: pushIdentifier(-T_byte); pushOnIntStack(this.scanner.currentPosition - 1); pushOnIntStack(this.scanner.startPosition); break; case TokenNamechar: pushIdentifier(-T_char); pushOnIntStack(this.scanner.currentPosition - 1); pushOnIntStack(this.scanner.startPosition); break; case TokenNamedouble: pushIdentifier(-T_double); pushOnIntStack(this.scanner.currentPosition - 1); pushOnIntStack(this.scanner.startPosition); break; case TokenNamefloat: pushIdentifier(-T_float); pushOnIntStack(this.scanner.currentPosition - 1); pushOnIntStack(this.scanner.startPosition); break; case TokenNameint: pushIdentifier(-T_int); pushOnIntStack(this.scanner.currentPosition - 1); pushOnIntStack(this.scanner.startPosition); break; case TokenNamelong: pushIdentifier(-T_long); pushOnIntStack(this.scanner.currentPosition - 1); pushOnIntStack(this.scanner.startPosition); break; case TokenNameshort: pushIdentifier(-T_short); pushOnIntStack(this.scanner.currentPosition - 1); pushOnIntStack(this.scanner.startPosition); break; //============================== case TokenNameIntegerLiteral: pushOnExpressionStack(IntLiteral.buildIntLiteral(this.scanner.getCurrentTokenSource(), this.scanner.startPosition, this.scanner.currentPosition - 1)); break; case TokenNameLongLiteral: pushOnExpressionStack(LongLiteral.buildLongLiteral(this.scanner.getCurrentTokenSource(), this.scanner.startPosition, this.scanner.currentPosition - 1)); break; case TokenNameFloatingPointLiteral: pushOnExpressionStack(new FloatLiteral(this.scanner.getCurrentTokenSource(), this.scanner.startPosition, this.scanner.currentPosition - 1)); break; case TokenNameDoubleLiteral: pushOnExpressionStack(new DoubleLiteral(this.scanner.getCurrentTokenSource(), this.scanner.startPosition, this.scanner.currentPosition - 1)); break; case TokenNameCharacterLiteral: pushOnExpressionStack(new CharLiteral(this.scanner.getCurrentTokenSource(), this.scanner.startPosition, this.scanner.currentPosition - 1)); break; case TokenNameStringLiteral: StringLiteral stringLiteral; if (this.recordStringLiterals && this.checkExternalizeStrings && this.lastPosistion < this.scanner.currentPosition && !this.statementRecoveryActivated) { stringLiteral = createStringLiteral(this.scanner.getCurrentTokenSourceString(), this.scanner.startPosition, this.scanner.currentPosition - 1, Util.getLineNumber( this.scanner.startPosition, this.scanner.lineEnds, 0, this.scanner.linePtr)); this.compilationUnit.recordStringLiteral(stringLiteral, this.currentElement != null); } else { stringLiteral = createStringLiteral(this.scanner.getCurrentTokenSourceString(), this.scanner.startPosition, this.scanner.currentPosition - 1, 0); } pushOnExpressionStack(stringLiteral); break; case TokenNamefalse: pushOnExpressionStack(new FalseLiteral(this.scanner.startPosition, this.scanner.currentPosition - 1)); break; case TokenNametrue: pushOnExpressionStack(new TrueLiteral(this.scanner.startPosition, this.scanner.currentPosition - 1)); break; case TokenNamenull: pushOnExpressionStack(new NullLiteral(this.scanner.startPosition, this.scanner.currentPosition - 1)); break; //============================ case TokenNamesuper: case TokenNamethis: this.endPosition = this.scanner.currentPosition - 1; pushOnIntStack(this.scanner.startPosition); break; case TokenNameassert: case TokenNameimport: case TokenNamepackage: case TokenNamethrow: case TokenNamedo: case TokenNameif: case TokenNamefor: case TokenNameswitch: case TokenNametry: case TokenNamewhile: case TokenNamebreak: case TokenNamecontinue: case TokenNamereturn: case TokenNamecase: pushOnIntStack(this.scanner.startPosition); break; case TokenNamenew: // https://bugs.eclipse.org/bugs/show_bug.cgi?id=40954 resetModifiers(); pushOnIntStack(this.scanner.startPosition); break; case TokenNameclass: pushOnIntStack(this.scanner.currentPosition - 1); pushOnIntStack(this.scanner.startPosition); break; case TokenNameenum: pushOnIntStack(this.scanner.currentPosition - 1); pushOnIntStack(this.scanner.startPosition); break; case TokenNamedefault: pushOnIntStack(this.scanner.startPosition); pushOnIntStack(this.scanner.currentPosition - 1); break; //let extra semantic action decide when to push case TokenNameRBRACKET: this.endPosition = this.scanner.startPosition; this.endStatementPosition = this.scanner.currentPosition - 1; break; case TokenNameLBRACE: this.endStatementPosition = this.scanner.currentPosition - 1; //$FALL-THROUGH$ case TokenNamePLUS: case TokenNameMINUS: case TokenNameNOT: case TokenNameTWIDDLE: this.endPosition = this.scanner.startPosition; break; case TokenNamePLUS_PLUS: case TokenNameMINUS_MINUS: this.endPosition = this.scanner.startPosition; this.endStatementPosition = this.scanner.currentPosition - 1; break; case TokenNameRBRACE: case TokenNameSEMICOLON: this.endStatementPosition = this.scanner.currentPosition - 1; this.endPosition = this.scanner.startPosition - 1; //the item is not part of the potential futur expression/statement break; case TokenNameRPAREN: // in order to handle ( expression) ////// (cast)expression///// foo(x) this.rParenPos = this.scanner.currentPosition - 1; // position of the end of right parenthesis (in case of unicode \u0029) lex00101 break; case TokenNameLPAREN: this.lParenPos = this.scanner.startPosition; break; case TokenNameAT: pushOnIntStack(this.scanner.startPosition); break; case TokenNameQUESTION: pushOnIntStack(this.scanner.startPosition); pushOnIntStack(this.scanner.currentPosition - 1); break; case TokenNameLESS: pushOnIntStack(this.scanner.startPosition); break; case TokenNameELLIPSIS: pushOnIntStack(this.scanner.currentPosition - 1); break; case TokenNameEQUAL: if (this.currentElement != null && this.currentElement instanceof RecoveredAnnotation) { RecoveredAnnotation recoveredAnnotation = (RecoveredAnnotation) this.currentElement; if (recoveredAnnotation.memberValuPairEqualEnd == -1) { recoveredAnnotation.memberValuPairEqualEnd = this.scanner.currentPosition - 1; } } break; case TokenNameMULTIPLY: // star end position pushOnIntStack(this.scanner.currentPosition - 1); break; // case TokenNameCOMMA : // case TokenNameCOLON : // case TokenNameLBRACKET : // case TokenNameDOT : // case TokenNameERROR : // case TokenNameEOF : // case TokenNamecase : // case TokenNamecatch : // case TokenNameelse : // case TokenNameextends : // case TokenNamefinally : // case TokenNameimplements : // case TokenNamethrows : // case TokenNameinstanceof : // case TokenNameEQUAL_EQUAL : // case TokenNameLESS_EQUAL : // case TokenNameGREATER_EQUAL : // case TokenNameNOT_EQUAL : // case TokenNameLEFT_SHIFT : // case TokenNameRIGHT_SHIFT : // case TokenNameUNSIGNED_RIGHT_SHIFT : // case TokenNamePLUS_EQUAL : // case TokenNameMINUS_EQUAL : // case TokenNameMULTIPLY_EQUAL : // case TokenNameDIVIDE_EQUAL : // case TokenNameAND_EQUAL : // case TokenNameOR_EQUAL : // case TokenNameXOR_EQUAL : // case TokenNameREMAINDER_EQUAL : // case TokenNameLEFT_SHIFT_EQUAL : // case TokenNameRIGHT_SHIFT_EQUAL : // case TokenNameUNSIGNED_RIGHT_SHIFT_EQUAL : // case TokenNameOR_OR : // case TokenNameAND_AND : // case TokenNameREMAINDER : // case TokenNameXOR : // case TokenNameAND : // case TokenNameMULTIPLY : // case TokenNameOR : // case TokenNameDIVIDE : // case TokenNameGREATER : } }