From d960df53c7b82ac6af321836cb7d14ea4d11595e Mon Sep 17 00:00:00 2001 From: mhaupt Date: Fri, 29 Apr 2016 15:30:43 +0200 Subject: 8155106: MHs.Lookup.findConstructor returns handles for array classes Reviewed-by: sundar --- src/share/classes/java/lang/invoke/MethodHandles.java | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'src/share/classes/java/lang') diff --git a/src/share/classes/java/lang/invoke/MethodHandles.java b/src/share/classes/java/lang/invoke/MethodHandles.java index 8511890481..3985340039 100644 --- a/src/share/classes/java/lang/invoke/MethodHandles.java +++ b/src/share/classes/java/lang/invoke/MethodHandles.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2008, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2008, 2016, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -916,6 +916,9 @@ assertEquals("[x, y, z]", pb.command().toString()); * @throws NullPointerException if any argument is null */ public MethodHandle findConstructor(Class refc, MethodType type) throws NoSuchMethodException, IllegalAccessException { + if (refc.isArray()) { + throw new NoSuchMethodException("no constructor for array class: " + refc.getName()); + } String name = ""; MemberName ctor = resolveOrFail(REF_newInvokeSpecial, refc, name, type); return getDirectConstructor(refc, ctor); -- cgit v1.2.3