JDK-8202012 : IllegalArgumentException getMessage() becomes null after 16 calls.
  • Type: Bug
  • Component: core-libs
  • Sub-Component: java.lang:reflect
  • Affected Version: 8,9,10,11
  • Priority: P4
  • Status: Closed
  • Resolution: Cannot Reproduce
  • OS: generic
  • CPU: x86_64
  • Submitted: 2018-04-19
  • Updated: 2022-02-09
  • Resolved: 2022-02-09
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
Other
tbd_minorResolved
Related Reports
Duplicate :  
Relates :  
Description
ADDITIONAL SYSTEM INFORMATION :
Windows 10. Java 1.8u152

A DESCRIPTION OF THE PROBLEM :
I expect the same exception type with the same message for each call of attached source code.

STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
Run attached source code.

EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
I expect the same exception type with the same message for each call.
ACTUAL -
The message changes after 16th invocation.

---------- BEGIN SOURCE ----------
package test;

import java.lang.reflect.Method;

public class Start {

    public static int method(byte a, int b) {
        return b + a;
    }

    public static void main(String[] args) throws Exception {
        int i = 0;
        Method m = Start.class.getMethod("method", new Class<?>[] { byte.class, int.class });
        while (i < 17) {
            try {
                m.invoke(null, new Double(0), new Integer(0));
            } catch (IllegalArgumentException e) {
                // e.printStackTrace();
                System.out.println(e.getMessage());
            }
            i++;
        }

    }
}
---------- END SOURCE ----------

FREQUENCY : always



Comments
Not reproducible after JDK-8266010.
09-02-2022

This should resolve itself once core reflection is re-implemented to use method handles.
14-04-2021

Still reproducible with JDK 16.
13-04-2021

This is the generated method accessor, it is generated and used once the inflation threshold (15) is exceeded. The generated code should throw IAE with a more useful exception message.
19-04-2018

This issue is reproducible in all the versions 8uxx - Fail 9.0.4 - Fail 10 GA - Fail 11 ea b08 - Fail Below is the snapshot executed on 10GA == -sh-4.2$ /scratch/fairoz/JAVA/jdk10/jdk-10_GA/bin/java Start argument type mismatch argument type mismatch argument type mismatch argument type mismatch argument type mismatch argument type mismatch argument type mismatch argument type mismatch argument type mismatch argument type mismatch argument type mismatch argument type mismatch argument type mismatch argument type mismatch argument type mismatch argument type mismatch null -sh-4.2$
19-04-2018