you need to and them out something like
setModifiers((getModifiers() | Constants.ACC_PUBLIC) & ~(Constants.ACC_PRIVATE|Constants.ACC_PROTECTED)); Quoting Shrinivas Joshi <[EMAIL PROTECTED]>: > Hi All, > I need to change access modifiers of all fields of a particular class > to public access. > When I use setModifiers(Constants.ACC_PUBLIC) the other attributes such as > static, final etc are not retained. The field modifier is then set to just > public. I tried using bitwise OR of Constants.ACC_PUBLIC with existing > modifiers and noticed that it retains the other access attributes and also > changes the field modifier to public. But doesnt works for protected > fields as bitwise OR results in 0x5 value which is not valid value. > Please let me know if I am doing it right or missing something over here. > > Thanks and Regards > Shrinivas Joshi > > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]