-
Notifications
You must be signed in to change notification settings - Fork 44
Closed
Labels
2.xIssue applies to Gizmo 2.xIssue applies to Gizmo 2.xquestionFurther information is requestedFurther information is requested
Milestone
Description
I agree that the defaults should just follow the JLS. But in Gizmo1 the defaults differ. For example, the MethodCreator
produces public
methods by default, fields are private
(unless declared on an interface), etc. In some cases, it's more convenient. By the way, even in Gizmo2 the generated class is public
by default, and not package private.
I wonder if we should stick with the same rules to ease the migration, or maybe introduce something like "default flag profiles"?
public interface AccessFlagProfile {
public Collection<AccessFlag> methodFlags();
}
public class PublicFinalMethods implements AccessFlagProfile {
public Collection<AccessFlag> methodFlags() {
return List.of(AccessFlag.PUBLIC, AccessFlag.FINAL);
}
}
g.class_(ClassDesc.of("org.acme.Foo"), cc -> {
cc.withAccessFlagProfile(new PublicFinalMethods()); // all methods will be "public final" by default
}
And have some predefined profiles... like GIZMO1
.
Maybe I'm wrong. I'm just throwing ideas...
Metadata
Metadata
Assignees
Labels
2.xIssue applies to Gizmo 2.xIssue applies to Gizmo 2.xquestionFurther information is requestedFurther information is requested
Type
Projects
Status
Done