Java Code Examples for com.puppycrawl.tools.checkstyle.api.TokenTypes#CLASS_DEF
The following examples show how to use
com.puppycrawl.tools.checkstyle.api.TokenTypes#CLASS_DEF .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: TableMaker.java From cacheonix-core with GNU Lesser General Public License v2.1 | 6 votes |
/** * * If the class has a super class a reference to this super class * is added to this class. * @return <code>void</code> * @see net.sourceforge.transmogrify.symtab.ClassDef */ private void setSuperclass() { if (_def.getTreeNode().getType() == TokenTypes.CLASS_DEF) { SymTabAST extendsNode = getExtendsNode(_def); if ( extendsNode != null ) { String superclassName = ASTUtil.constructDottedName(extendsNode); IClass superclass = _def.getClassDefinition(superclassName); if ( superclass != null ) { _def.setSuperclass( superclass ); superclass.addSubclass( _def ); } } else { _def.setSuperclass(new ExternalClass(Object.class)); } } else { _def.setSuperclass(new ExternalClass(Object.class)); } }
Example 2
Source File: TableMaker.java From cacheonix-core with GNU Lesser General Public License v2.1 | 6 votes |
/** * * If the class implements an interface a reference to this interface * is added to this class. * @return <code>void</code> * @see net.sourceforge.transmogrify.symtab.ClassDef */ private void addInterfaces() { SymTabAST implementsClause = null; if (_def.getTreeNode().getType() == TokenTypes.CLASS_DEF) { implementsClause = _node.findFirstToken(TokenTypes.IMPLEMENTS_CLAUSE); } else { implementsClause = _node.findFirstToken(TokenTypes.EXTENDS_CLAUSE); } if ( implementsClause != null ) { SymTabAST interfaceNode = (SymTabAST)implementsClause.getFirstChild(); while ( interfaceNode != null ) { IClass implemented = _def.getClassDefinition(interfaceNode.getText()); if ( implemented != null ) { _def.addInterface( implemented ); implemented.addImplementor( _def ); } interfaceNode = (SymTabAST)(interfaceNode.getNextSibling()); } } }
Example 3
Source File: TableMaker.java From contribution with GNU Lesser General Public License v2.1 | 6 votes |
/** * * If the class has a super class a reference to this super class * is added to this class. * @return <code>void</code> * @see net.sourceforge.transmogrify.symtab.ClassDef */ private void setSuperclass() { if (_def.getTreeNode().getType() == TokenTypes.CLASS_DEF) { SymTabAST extendsNode = getExtendsNode(_def); if ( extendsNode != null ) { String superclassName = ASTUtil.constructDottedName(extendsNode); IClass superclass = _def.getClassDefinition(superclassName); if ( superclass != null ) { _def.setSuperclass( superclass ); superclass.addSubclass( _def ); } } else { _def.setSuperclass(new ExternalClass(Object.class)); } } else { _def.setSuperclass(new ExternalClass(Object.class)); } }
Example 4
Source File: TableMaker.java From contribution with GNU Lesser General Public License v2.1 | 6 votes |
/** * * If the class implements an interface a reference to this interface * is added to this class. * @return <code>void</code> * @see net.sourceforge.transmogrify.symtab.ClassDef */ private void addInterfaces() { SymTabAST implementsClause = null; if (_def.getTreeNode().getType() == TokenTypes.CLASS_DEF) { implementsClause = _node.findFirstToken(TokenTypes.IMPLEMENTS_CLAUSE); } else { implementsClause = _node.findFirstToken(TokenTypes.EXTENDS_CLAUSE); } if ( implementsClause != null ) { SymTabAST interfaceNode = (SymTabAST)implementsClause.getFirstChild(); while ( interfaceNode != null ) { IClass implemented = _def.getClassDefinition(interfaceNode.getText()); if ( implemented != null ) { _def.addInterface( implemented ); implemented.addImplementor( _def ); } interfaceNode = (SymTabAST)(interfaceNode.getNextSibling()); } } }
Example 5
Source File: MissingSdkAnnotationCheck.java From aws-sdk-java-v2 with Apache License 2.0 | 5 votes |
@Override public int[] getRequiredTokens() { return new int[] { TokenTypes.CLASS_DEF, TokenTypes.INTERFACE_DEF }; }
Example 6
Source File: SpringJavadocCheck.java From spring-javaformat with Apache License 2.0 | 4 votes |
@Override public int[] getDefaultTokens() { return new int[] { TokenTypes.INTERFACE_DEF, TokenTypes.CLASS_DEF, TokenTypes.ENUM_DEF, TokenTypes.ANNOTATION_DEF, TokenTypes.METHOD_DEF, TokenTypes.CTOR_DEF }; }
Example 7
Source File: SpringJavadocCheck.java From spring-javaformat with Apache License 2.0 | 4 votes |
@Override public int[] getAcceptableTokens() { return new int[] { TokenTypes.INTERFACE_DEF, TokenTypes.CLASS_DEF, TokenTypes.ENUM_DEF, TokenTypes.ANNOTATION_DEF, TokenTypes.METHOD_DEF, TokenTypes.CTOR_DEF, TokenTypes.ENUM_CONSTANT_DEF, TokenTypes.ANNOTATION_FIELD_DEF }; }
Example 8
Source File: SpringMethodOrderCheck.java From spring-javaformat with Apache License 2.0 | 4 votes |
@Override public int[] getAcceptableTokens() { return new int[] { TokenTypes.CLASS_DEF, TokenTypes.INTERFACE_DEF }; }
Example 9
Source File: MethodLimitCheck.java From eclipse-cs with GNU Lesser General Public License v2.1 | 4 votes |
@Override public int[] getAcceptableTokens() { return new int[] { TokenTypes.CLASS_DEF, TokenTypes.INTERFACE_DEF }; }
Example 10
Source File: MethodLimitCheck.java From eclipse-cs with GNU Lesser General Public License v2.1 | 4 votes |
@Override public int[] getDefaultTokens() { return new int[] { TokenTypes.CLASS_DEF, TokenTypes.INTERFACE_DEF }; }
Example 11
Source File: PluralEnumNames.java From aws-sdk-java-v2 with Apache License 2.0 | 4 votes |
@Override public int[] getRequiredTokens() { return new int[] { TokenTypes.CLASS_DEF, TokenTypes.ENUM_DEF }; }
Example 12
Source File: OneMethodPrivateFieldCheck.java From cacheonix-core with GNU Lesser General Public License v2.1 | 4 votes |
/** @see com.puppycrawl.tools.checkstyle.checks.usage.AbstractUsageCheck */ public void applyTo(Set aNodes) { // apply the check to each private field final Set methods = new HashSet(); final Iterator it = aNodes.iterator(); while (it.hasNext()) { methods.clear(); final DetailAST nameAST = (DetailAST) it.next(); // find methods using the field final Iterator refIt = getReferences(nameAST); while (refIt.hasNext()) { final Reference ref = (Reference) refIt.next(); final SymTabAST refNode = ref.getTreeNode(); final DetailAST refDetail = refNode.getDetailNode(); // don't need to check a self-reference if (refDetail == nameAST) { continue; } DetailAST parent = refDetail.getParent(); while (parent != null) { final int type = parent.getType(); if ((type == TokenTypes.METHOD_DEF) || (type == TokenTypes.CTOR_DEF) || (type == TokenTypes.INSTANCE_INIT) || (type == TokenTypes.STATIC_INIT)) { methods.add(parent); break; } // initializer for inner class? else if (type == TokenTypes.CLASS_DEF) { break; } parent = parent.getParent(); } } if (methods.size() == 1) { log( nameAST.getLineNo(), nameAST.getColumnNo(), getErrorKey(), nameAST.getText()); } } }
Example 13
Source File: OneMethodPrivateFieldCheck.java From contribution with GNU Lesser General Public License v2.1 | 4 votes |
/** @see com.puppycrawl.tools.checkstyle.checks.usage.AbstractUsageCheck */ public void applyTo(Set aNodes) { // apply the check to each private field final Set methods = new HashSet(); final Iterator it = aNodes.iterator(); while (it.hasNext()) { methods.clear(); final DetailAST nameAST = (DetailAST) it.next(); // find methods using the field final Iterator refIt = getReferences(nameAST); while (refIt.hasNext()) { final Reference ref = (Reference) refIt.next(); final SymTabAST refNode = ref.getTreeNode(); final DetailAST refDetail = refNode.getDetailNode(); // don't need to check a self-reference if (refDetail == nameAST) { continue; } DetailAST parent = refDetail.getParent(); while (parent != null) { final int type = parent.getType(); if ((type == TokenTypes.METHOD_DEF) || (type == TokenTypes.CTOR_DEF) || (type == TokenTypes.INSTANCE_INIT) || (type == TokenTypes.STATIC_INIT)) { methods.add(parent); break; } // initializer for inner class? else if (type == TokenTypes.CLASS_DEF) { break; } parent = parent.getParent(); } } if (methods.size() == 1) { log( nameAST.getLineNo(), nameAST.getColumnNo(), getErrorKey(), nameAST.getText()); } } }
Example 14
Source File: MonitoringRecordFactoryConventionCheck.java From kieker with Apache License 2.0 | 4 votes |
@Override public int[] getDefaultTokens() { // This here makes sure that we just get classes return new int[] { TokenTypes.CLASS_DEF }; }
Example 15
Source File: AnalysisComponentConstructorCheck.java From kieker with Apache License 2.0 | 4 votes |
@Override public int[] getDefaultTokens() { // This here makes sure that we just get classes return new int[] { TokenTypes.CLASS_DEF }; }
Example 16
Source File: MissingSinceTagCheck.java From kieker with Apache License 2.0 | 4 votes |
@Override public int[] getDefaultTokens() { // This here makes sure that we just get the correct components return new int[] { TokenTypes.CLASS_DEF, TokenTypes.INTERFACE_DEF, TokenTypes.ANNOTATION_DEF, TokenTypes.ENUM_DEF }; }