RFR: JDK-8216558: Lookup.unreflectSetter(Field) fails to throw IllegalAccessException for final fields

Mandy Chung mandy.chung at oracle.com
Wed Jan 16 23:52:03 UTC 2019


Hi Adam,

On 1/14/19 9:10 AM, Adam Farley8 wrote:
> As for the CSR process, I'm unfamiliar with it. I've modified the
> comment for the unreflectSetter method in the webrev. Do let me know if
> more needs to be done.

The CSR process is straight-forward.  CSR FAQ [1] may help you get started.

As for the fix, John has suggested the spec wording for this issue. It's 
fine with the unreflectField method to have the explicit check and throw 
field.makeAccessException(...).   The exception message could match the 
proposed spec wording like:
      if(isSetter && field.isStatic() && field.isFinal())
          throw field.makeAccessException("static final field has no 
write access", this);

You have a very long line and the throw statement can start in the next 
line.

In addition, please include a test case for this change.

Thanks
Mandy
[1] https://wiki.openjdk.java.net/display/csr/CSR+FAQs


More information about the core-libs-dev mailing list