当前位置: 首页>>代码示例>>Java>>正文


Java JCTree.JCClassDecl方法代码示例

本文整理汇总了Java中com.sun.tools.javac.tree.JCTree.JCClassDecl方法的典型用法代码示例。如果您正苦于以下问题:Java JCTree.JCClassDecl方法的具体用法?Java JCTree.JCClassDecl怎么用?Java JCTree.JCClassDecl使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.sun.tools.javac.tree.JCTree的用法示例。


在下文中一共展示了JCTree.JCClassDecl方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: visitClassDef

import com.sun.tools.javac.tree.JCTree; //导入方法依赖的package包/类
@Override
public void visitClassDef( JCTree.JCClassDecl tree )
{
  super.visitClassDef( tree );
  if( tree.sym != null && !tree.sym.isInner() )
  {
    if( !hasNoBootstrap( tree.getModifiers().getAnnotations() ) )
    {
      JCTree.JCStatement newNode = buildBootstrapStaticBlock();
      ArrayList<JCTree> newDefs = new ArrayList<>( tree.defs );
      newDefs.add( 0, newNode );
      tree.defs = List.from( newDefs );
    }
  }
  result = tree;
}
 
开发者ID:manifold-systems,项目名称:manifold,代码行数:17,代码来源:BootstrapInserter.java

示例2: makeStubFromSource

import com.sun.tools.javac.tree.JCTree; //导入方法依赖的package包/类
private SrcClass makeStubFromSource()
{
  List<CompilationUnitTree> trees = new ArrayList<>();
  JavaParser.instance().parseText( _existingSource, trees, null, null, null );
  JCTree.JCClassDecl classDecl = (JCTree.JCClassDecl)trees.get( 0 ).getTypeDecls().get( 0 );
  SrcClass srcExtended = new SrcClass( _fqn, classDecl.getKind() == Tree.Kind.CLASS ? SrcClass.Kind.Class : SrcClass.Kind.Interface )
    .modifiers( classDecl.getModifiers().getFlags() );
  if( classDecl.extending != null )
  {
    srcExtended.superClass( classDecl.extending.toString() );
  }
  for( JCTree.JCExpression iface : classDecl.implementing )
  {
    srcExtended.addInterface( iface.toString() );
  }
  return srcExtended;
}
 
开发者ID:manifold-systems,项目名称:manifold,代码行数:18,代码来源:ExtCodeGen.java

示例3: getClassDecl

import com.sun.tools.javac.tree.JCTree; //导入方法依赖的package包/类
private JCTree.JCClassDecl getClassDecl( Model model )
{
  JCTree.JCClassDecl classDecl = model.getClassDecl();
  if( classDecl != null )
  {
    return classDecl;
  }

  List<CompilationUnitTree> trees = new ArrayList<>();
  JavaParser.instance().parseText( getSource( model ), trees, null, null, null );
  if( trees.isEmpty() )
  {
    return null;
  }
  classDecl = (JCTree.JCClassDecl)trees.get( 0 ).getTypeDecls().get( 0 );
  model.setClassDecl( classDecl );
  return classDecl;
}
 
开发者ID:manifold-systems,项目名称:manifold,代码行数:19,代码来源:DarkJavaTypeManifold.java

示例4: addInputFile

import com.sun.tools.javac.tree.JCTree; //导入方法依赖的package包/类
private void addInputFile( TaskEvent e )
{
  if( !_initialized )
  {
    CompilationUnitTree compilationUnit = e.getCompilationUnit();
    ExpressionTree pkg = compilationUnit.getPackageName();
    String packageQualifier = pkg == null ? "" : (pkg.toString() + '.');
    for( Tree classDecl : compilationUnit.getTypeDecls() )
    {
      if( classDecl instanceof JCTree.JCClassDecl )
      {
        _javaInputFiles.add( new Pair<>( packageQualifier + ((JCTree.JCClassDecl)classDecl).getSimpleName(), compilationUnit.getSourceFile() ) );
      }
    }
  }
}
 
开发者ID:manifold-systems,项目名称:manifold,代码行数:17,代码来源:JavacPlugin.java

示例5: visitClassDef

import com.sun.tools.javac.tree.JCTree; //导入方法依赖的package包/类
@Override public void visitClassDef(JCTree.JCClassDecl jcClassDecl) {
  for (JCTree tree : jcClassDecl.defs) {
    if (tree instanceof ClassTree) {
      ClassTree classTree = (ClassTree) tree;
      String className = classTree.getSimpleName().toString();
      if (SUPPORTED_TYPES.contains(className)) {
        ClassName rClassName = ClassName.get(rPackageName, "R", className);
        VarScanner scanner = new VarScanner(ids, rClassName, respectivePackageName);
        ((JCTree) classTree).accept(scanner);
      }
    }
  }
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:14,代码来源:ButterKnifeProcessor.java

示例6: visitClassDef

import com.sun.tools.javac.tree.JCTree; //导入方法依赖的package包/类
@Override
public void visitClassDef(JCTree.JCClassDecl jcClassDecl) {
    for (JCTree tree : jcClassDecl.defs) {
        if (tree instanceof ClassTree) {
            ClassTree classTree = (ClassTree) tree;
            String className = classTree.getSimpleName().toString();
            if (supportedTypes.contains(className)) {
                ClassName rClassName = ClassName.get(rPackageName, "R", className);
                VarScanner scanner = new VarScanner(ids, rClassName, respectivePackageName);
                ((JCTree) classTree).accept(scanner);
            }
        }
    }
}
 
开发者ID:hendraanggrian,项目名称:r-parser,代码行数:15,代码来源:IdScanner.java

示例7: preserveInnerClassesForGeneration

import com.sun.tools.javac.tree.JCTree; //导入方法依赖的package包/类
private void preserveInnerClassesForGeneration( JCTree.JCClassDecl tree )
{
  for( JCTree def: tree.defs )
  {
    if( def instanceof JCTree.JCClassDecl )
    {
      JCTree.JCClassDecl classDecl = (JCTree.JCClassDecl)def;

      preserveInnerClassForGenerationPhase( classDecl );
      preserveInnerClassesForGeneration( classDecl );
    }
  }
}
 
开发者ID:manifold-systems,项目名称:manifold,代码行数:14,代码来源:CompiledTypeProcessor.java

示例8: visitClassDef

import com.sun.tools.javac.tree.JCTree; //导入方法依赖的package包/类
@Override
public void visitClassDef( JCTree.JCClassDecl tree )
{
  super.visitClassDef( tree );

  verifyExtensionInterfaces( tree );
}
 
开发者ID:manifold-systems,项目名称:manifold,代码行数:8,代码来源:ExtensionTransformer.java

示例9: verifyExtensionInterfaces

import com.sun.tools.javac.tree.JCTree; //导入方法依赖的package包/类
private void verifyExtensionInterfaces( JCTree.JCClassDecl tree )
{
  if( !hasAnnotation( tree.getModifiers().getAnnotations(), Extension.class ) )
  {
    return;
  }

  outer:
  for( JCExpression iface: tree.getImplementsClause() )
  {
    final Symbol.TypeSymbol ifaceSym = iface.type.tsym;
    if( ifaceSym == _tp.getSymtab().objectType.tsym )
    {
      continue;
    }

    for( Attribute.Compound anno: ifaceSym.getAnnotationMirrors() )
    {
      if( anno.type.toString().equals( Structural.class.getName() ) )
      {
        continue outer;
      }
    }
    // extension interfaces must be structural
    _tp.report( iface, Diagnostic.Kind.ERROR, ExtIssueMsg.MSG_ONLY_STRUCTURAL_INTERFACE_ALLOWED_HERE.get( iface.toString() ) );
  }
}
 
开发者ID:manifold-systems,项目名称:manifold,代码行数:28,代码来源:ExtensionTransformer.java

示例10: visitMethodDef

import com.sun.tools.javac.tree.JCTree; //导入方法依赖的package包/类
/**
 * Issue errors/warnings if an extension method violates extension method grammar or conflicts with an existing method
 */
@Override
public void visitMethodDef( JCTree.JCMethodDecl tree )
{
  if( isBridgeMethod( tree ) )
  {
    // we process bridge methods during Generation, since they don't exist prior to Generation
    _bridgeMethod = true;
  }
  try
  {
    super.visitMethodDef( tree );
  }
  finally
  {
    _bridgeMethod = false;
  }

  if( _tp.isGenerate() )
  {
    // Don't process tree during GENERATE, unless the tree was generated e.g., a bridge method
    return;
  }

  if( tree.sym.owner.isAnonymous() )
  {
    // Keep track of anonymous classes so we can process any bridge methods added to them
    JCTree.JCClassDecl anonymousClassDef = (JCTree.JCClassDecl)_tp.getTreeUtil().getTree( tree.sym.owner );
    _tp.preserveInnerClassForGenerationPhase( anonymousClassDef );
  }

  verifyExtensionMethod( tree );
  result = tree;
}
 
开发者ID:manifold-systems,项目名称:manifold,代码行数:37,代码来源:ExtensionTransformer.java

示例11: isFromExtensionClass

import com.sun.tools.javac.tree.JCTree; //导入方法依赖的package包/类
private boolean isFromExtensionClass( JCTree.JCMethodDecl tree )
{
  Tree parent = _tp.getParent( tree );
  if( parent instanceof JCTree.JCClassDecl )
  {
    if( hasAnnotation( ((JCTree.JCClassDecl)parent).getModifiers().getAnnotations(), Extension.class ) )
    {
      return true;
    }
  }
  return false;
}
 
开发者ID:manifold-systems,项目名称:manifold,代码行数:13,代码来源:ExtensionTransformer.java

示例12: isInnerType

import com.sun.tools.javac.tree.JCTree; //导入方法依赖的package包/类
@Override
protected boolean isInnerType( String topLevel, String relativeInner )
{
  if( isAnonymous( relativeInner ) )
  {
    return true;
  }

  Model model = getModel( topLevel );
  if( model == null )
  {
    return false;
  }

  JCTree.JCClassDecl classDecl = getClassDecl( model );
  if( classDecl == null )
  {
    return false;
  }

  for( JCTree m: classDecl.getMembers() )
  {
    if( m instanceof JCTree.JCClassDecl )
    {
      return isInnerClass( (JCTree.JCClassDecl)m, relativeInner );
    }
  }

  return false;
}
 
开发者ID:manifold-systems,项目名称:manifold,代码行数:31,代码来源:DarkJavaTypeManifold.java

示例13: process

import com.sun.tools.javac.tree.JCTree; //导入方法依赖的package包/类
private void process( TaskEvent e )
{
  Set<String> typesToProcess = new HashSet<>();
  ExpressionTree pkg = e.getCompilationUnit().getPackageName();
  String packageQualifier = pkg == null ? "" : (pkg.toString() + '.');
  for( Tree classDecl : e.getCompilationUnit().getTypeDecls() )
  {
    if( classDecl instanceof JCTree.JCClassDecl )
    {
      typesToProcess.add( packageQualifier + ((JCTree.JCClassDecl)classDecl).getSimpleName() );
      insertBootstrap( (JCTree.JCClassDecl)classDecl );
    }
  }
  _typeProcessor.addTypesToProcess( typesToProcess );
}
 
开发者ID:manifold-systems,项目名称:manifold,代码行数:16,代码来源:JavacPlugin.java

示例14: getClassDecl

import com.sun.tools.javac.tree.JCTree; //导入方法依赖的package包/类
public JCTree.JCClassDecl getClassDecl( Tree node )
{
  if( node == null || node instanceof JCTree.JCCompilationUnit )
  {
    return null;
  }

  if( node instanceof JCTree.JCClassDecl )
  {
    return (JCTree.JCClassDecl)node;
  }

  return getClassDecl( getParent( node ) );
}
 
开发者ID:manifold-systems,项目名称:manifold,代码行数:15,代码来源:CompiledTypeProcessor.java

示例15: AnonymousClassListener

import com.sun.tools.javac.tree.JCTree; //导入方法依赖的package包/类
public AnonymousClassListener( JCTree.JCClassDecl tree )
{
  _tree = tree;
}
 
开发者ID:manifold-systems,项目名称:manifold,代码行数:5,代码来源:CompiledTypeProcessor.java


注:本文中的com.sun.tools.javac.tree.JCTree.JCClassDecl方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。