Created
August 26, 2023 19:19
-
-
Save CC007/5f7e0c050eeb7978f53de55c131dd1c2 to your computer and use it in GitHub Desktop.
Inconsistency between compiler and IntelliJ highlighting
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.github.cc007; | |
import lombok.ToString; | |
import manifold.ext.props.rt.api.PropOption; | |
import manifold.ext.props.rt.api.get; | |
import manifold.ext.props.rt.api.set; | |
import manifold.ext.props.rt.api.val; | |
import manifold.ext.props.rt.api.var; | |
import static manifold.ext.props.rt.api.PropOption.Private; | |
import static manifold.ext.props.rt.api.PropOption.Protected; | |
/** | |
* With manifold-props, you can specify if a field should have a getter and/or setter. | |
*/ | |
public class Demo7 { | |
// added lombok annotation to interact with the class fields from inside the class | |
@ToString | |
public static class Properties { | |
@var @set(Protected) public String protectedSet = "can only set in class and subclasses"; | |
@var @set(Private) String privateSet = "can only set in class itself"; | |
public Properties() { | |
protectedSet = "protected setter used in Properties"; | |
privateSet = "private setter used in Properties"; | |
} | |
} | |
public static class SubProperties extends Properties { | |
public SubProperties() { | |
protectedSet = "protected setter used in SubProperties"; | |
privateSet = "private setter used in SubProperties"; | |
} | |
} | |
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