RFR 8233272 : The Class.forName specification should be updated to match the long-standing implementation with respect to class linking
Mandy Chung
mandy.chung at oracle.com
Thu Nov 14 16:22:36 UTC 2019
On 11/13/19 10:37 AM, Brent Christian wrote:
> Hi,
>
> Recently, the 2-arg and 3-arg Class.forName() methods were updated[1]
> to perform class linking, per the specification. However this change
> had to be reverted[2].
>
> Instead, let's clarify the Class.forName() spec not to guarantee
> linking (outside the case of also performing initialization, of
> course). This is the long-standing behavior.
>
> I also have a test of the non-linking behavior; it's based on the test
> case[3] for JDK-8231924. It fails as of 14b14 (8212117) and passes as
> of 14b22 (8233091).
>
> Please review my webrev:
> http://cr.openjdk.java.net/~bchristi/8233272/webrev-02/
>
> If the wording looks good, I'll fill in the Specification for the
> CSR[4] I've started.
The spec change looks fine.
As for the test, I expect that it simply calls Class.forName("Provider",
false, ucl) and then should succeed.
Then calling Class.forName("Provider", true, ucl) should fail with an
error (I think it's EIIE with NCDFE?). This way it verifies that
initialization/linking does cause NCDFE during verification while
Class.forName does not do linking if initialize=false.
Mandy
More information about the hotspot-dev
mailing list