Skip to content

Instantly share code, notes, and snippets.

@CC007
Created August 27, 2023 19:17
Show Gist options
  • Save CC007/13c6211b20c3c64dfb023415fc98cf2c to your computer and use it in GitHub Desktop.
Save CC007/13c6211b20c3c64dfb023415fc98cf2c to your computer and use it in GitHub Desktop.
error when using multiple classes in one source file
package com.github.cc007;
import lombok.ToString;
import manifold.ext.props.rt.api.set;
import manifold.ext.props.rt.api.var;
import static manifold.ext.props.rt.api.PropOption.Package;
import static manifold.ext.props.rt.api.PropOption.Private;
import static manifold.ext.props.rt.api.PropOption.Protected;
/**
* With manifold-props, you can also specify if a setter should be private or protected.
*/
@ToString
class Properties {
@var @set(Protected) public String protectedSet = "can only set in class and subclasses and other classes in the same package";
@var @set(Package) String packagePrivateSet = "can only set in class and other classes in the same package";
@var @set(Private) String privateSet = "can only set in class itself";
public Properties() {
protectedSet = "protected setter used in Properties";
packagePrivateSet = "package-private setter used in Properties";
privateSet = "private setter used in Properties";
}
}
class SubProperties extends Properties {
public SubProperties() {
protectedSet = "protected setter used in SubProperties";
packagePrivateSet = "package-private setter used in SubProperties";
}
}
public class Demo7 {
public static void main(String[] args) {
Properties properties = new Properties();
System.out.println(properties);
SubProperties subProperties = new SubProperties();
System.out.println(subProperties);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment