Community
Participate
Working Groups
I have a modifier (ast node) in hand and want to find out if it is a public modifier. The code I have to write is: Modifier.isPublic(modifier.getKeyword().toFlagValue()) why can't I simply write: modifier.isPublic()
If only interested in checking flags, you could use: (method.getModifiers() & Modifier.PUBLIC) != 0 But I agree, more convenience methods wouldn't hurt.
What do you expect for this PR? New API?
Actually I am checking flags and annotations. That's why I am iterating over all extended modifiers of the method declaration node.
Do you suggest to add all these methods on org.eclipse.jdt.core.dom.Modifier? isPublic() isPrivate() isProtected() isStatic() isFinal() isSynchronized() isVolatile() isTransient() isNative() isAbstract() isStrictfp()
+1 since this is what I expected to have when I typed in my code. The static methods were good to use when the modifiers where still encoded as flags (JSL2), but with JSL3 I think we should have corresponding instance methods as well.
Fixed and released in HEAD. Added regression test in org.eclipse.jdt.core.tests.dom.ASTTest.testModifiers
Also added regression test in org.eclipse.jdt.core.tests.dom.ASTConverterTestAST3_2.test0443
Verified for 3.2 M5 using build I20060215-0010.