Skip to content

Gizmo2: simplify the way a public no-args constructor is constructed #227

@mkouba

Description

@mkouba

Currently, something like this is needed:

cc.constructor(con -> {
   con.public_();
   con.body(bc -> {
      bc.invokeSpecial(ConstructorDesc.of(Object.class), con.this_()); // replace ConstructorDesc.of(Object.class) with superclass
      bc.return_();
    });
});

Public no-args constructor is a very common thing to do (even javac adds the default no-args constructor automatically).

I don't think we should do that automatically but we should make it easier.

Metadata

Metadata

Assignees

Labels

2.xIssue applies to Gizmo 2.xenhancementNew feature or request

Type

No type

Projects

Status

Done

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions