本文整理匯總了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);
}
示例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 );
}