I use jdt(Ver=3.6.2.v_A76_R36x, API=JSL3) to generate a member method or field
I find the output method has no modifiers. setModifier(int) is @Deprecated,
So I use setFlag(int) method.I tried parameter Modifier.PUBLIC, Modifier.ModifierKeyword.PUBLIC_KEYWORD.toFlagValue(), neither works.
Code:
MethodDeclaration md = ast.newMethodDeclaration();
md.setFlags(Modifier.ModifierKeyword.PUBLIC_KEYWORD.toFlagValue());
md.setReturnType2(ast.newPrimitiveType(PrimitiveType.VOID));
// md.setFlags(Modifier.PUBLIC | Modifier.STATIC);
md.setName(ast.newSimpleName("onCreate"));
Output:
void onCreate( ...
Question:
Where public keyword gone? how to add modifier? why ? or a Bug?