RFR: 8256154: Some TestNG tests require default constructors

Daniel Fuchs dfuchs at openjdk.java.net
Thu Nov 19 16:39:06 UTC 2020


On Thu, 19 Nov 2020 15:56:59 GMT, Lance Andersen <lancea at openjdk.org> wrote:

>> In TestNG 7, it is a requirement that TestNG is able to create a Test object using a default constructor. 
>> 
>> This simple fix addresses two such classes so that this requirement is satisfied by inserting default construtors. Example: `public GetPackages() { ... }`
>> 
>> test/jdk/java/lang/Package/GetPackages.java
>> test/jdk/java/lang/StackWalker/Basic.java
>
> test/jdk/java/lang/StackWalker/Basic.java line 116:
> 
>> 114:     /** For TestNG */
>> 115:     public Basic() {
>> 116:         depth = 0;
> 
> Is the assignment really ended here?  I only see:
> 
> Basic test = new Basic(depth[0]);
> 
> So I would assume you would be fine with an empty constructor?

`depth` is `final`, so it needs to be assigned. but this could be replaced with `this(0)`

-------------

PR: https://git.openjdk.java.net/jdk/pull/1317


More information about the core-libs-dev mailing list