當前位置: 首頁>>代碼示例>>Java>>正文


Java Flags.VARARGS屬性代碼示例

本文整理匯總了Java中com.sun.tools.javac.code.Flags.VARARGS屬性的典型用法代碼示例。如果您正苦於以下問題:Java Flags.VARARGS屬性的具體用法?Java Flags.VARARGS怎麽用?Java Flags.VARARGS使用的例子?那麽, 這裏精選的屬性代碼示例或許可以為您提供幫助。您也可以進一步了解該屬性所在com.sun.tools.javac.code.Flags的用法示例。


在下文中一共展示了Flags.VARARGS屬性的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: isVarArgs

/**
 * Return true if this method was declared to take a variable number
 * of arguments.
 */
public boolean isVarArgs() {
    return ((sym.flags() & Flags.VARARGS) != 0
            && !env.legacyDoclet);
}
 
開發者ID:SunburstApps,項目名稱:OpenJSharp,代碼行數:8,代碼來源:ExecutableMemberDocImpl.java

示例2: addMethod

private void addMethod( IModule module, SrcClass srcClass, Symbol.MethodSymbol method, BasicJavacTask javacTask )
{
  SrcMethod srcMethod = new SrcMethod( srcClass );
  addAnnotations( srcMethod, method );
  srcMethod.modifiers( method.getModifiers() );
  if( (method.flags() & Flags.VARARGS) != 0 )
  {
    srcMethod.modifiers( srcMethod.getModifiers() | 0x00000080 ); // Modifier.VARARGS
  }
  String name = method.flatName().toString();
  if( name.equals( "<clinit>" ) )
  {
    return;
  }
  boolean isConstructor = name.equals( "<init>" );
  if( isConstructor )
  {
    srcMethod.name( srcClass.getSimpleName() );
    srcMethod.setConstructor( true );
  }
  else
  {
    srcMethod.name( name );
    srcMethod.returns( new SrcType( method.getReturnType().toString() ) );
  }
  for( Symbol.TypeVariableSymbol typeVar : method.getTypeParameters() )
  {
    srcMethod.addTypeVar( makeTypeVarType( typeVar ) );
  }
  for( Symbol.VarSymbol param : method.getParameters() )
  {
    SrcParameter srcParam = new SrcParameter( param.flatName().toString(), new SrcType( param.type.toString() ) );
    srcMethod.addParam( srcParam );
    addAnnotations( srcParam, param );
  }
  for( Type throwType : method.getThrownTypes() )
  {
    srcMethod.addThrowType( new SrcType( throwType.toString() ) );
  }
  String bodyStmt;
  if( srcMethod.isConstructor() )
  {
    // Note we can't just throw an exception for the ctor body, the compiler will
    // still complain about the missing super() cal if the super class does not have
    // an accessible default ctor. To appease the compiler we generate a super(...)
    // call to the first accessible constructor we can find in the super class.
    bodyStmt = genSuperCtorCall( module, srcClass, javacTask );
  }
  else
  {
    bodyStmt = "throw new RuntimeException();";
  }
  srcMethod.body( new SrcStatementBlock()
                    .addStatement(
                      new SrcRawStatement()
                        .rawText( bodyStmt ) ) );
  srcClass.addMethod( srcMethod );
}
 
開發者ID:manifold-systems,項目名稱:manifold,代碼行數:58,代碼來源:SrcClassUtil.java


注:本文中的com.sun.tools.javac.code.Flags.VARARGS屬性示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。