JDK-8043930 : TypeError when attemping to create an instance of non-public class could be better
  • Type: Bug
  • Component: core-libs
  • Sub-Component: jdk.nashorn
  • Affected Version: 9
  • Priority: P3
  • Status: Resolved
  • Resolution: Fixed
  • OS: generic
  • CPU: generic
  • Submitted: 2014-05-24
  • Updated: 2014-07-29
  • Resolved: 2014-05-26
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.
JDK 8 JDK 9
8u20Fixed 9 b15Fixed
Description
This issue was reported by Adrian Druzgalski ("amdruz")  via twitter.  

File: Foo.java

class Foo {
  public Foo() {}
}

$ javac Foo.java
$ jjs -classpath . 
jjs> var Foo = Java.type("Foo")
jjs> Foo
[JavaClass Foo]
jjs> var obj = new Foo();
<shell>:1 TypeError: Can not construct Foo with the passed arguments; they do not match any of its constructor signatures.

The error could say "Foo" is a non-public class and so an instance of that can't be created - rather than not being able to match a constructor.