Manifold is a Java compiler plugin, its features include Metaprogramming, Properties, Extension Methods, Operator Overloading, Templates, a Preprocessor, and more.
Describe the bug
When using @var, @val, @get and @set without parameter the resulting getter and/or setter is public by default. when you add PropOption.Private or PropOption.Package as an annotation parameter, the created method for the respective getter/setter will be private or package-private respectively. So far so good.
However for @get, @set and @var, when using PropOption.Public or PropOption.Protected, I get the following error:
java: 'get' attempting to assign weaker access privileges; was 'package'
If manifold were to follow the java standard and make the getters and setters package-private by default, I would understand this error, but since manifold makes these public by default, this error seems incorrect.
Also, for @val I get a different error:
java: java.lang.NullPointerException: Cannot invoke "com.sun.tools.javac.tree.JCTree.getStartPosition()" because "tree" is null
java: java.lang.NullPointerException: Cannot invoke "com.sun.tools.javac.tree.JCTree.getStartPosition()" because "tree" is null
Workaround
Marking the field as public solves the issue for all 4 cases and still properly makes the field private after compilation, but this seems redundant, since this should have been the default with Manifold.
To Reproduce
Steps to reproduce the behavior:
Build code from gist/picture
Expected behavior
I expected the use of Public and Protected to work as well, with all 4 annotations.
Screenshots
Desktop (please complete the following information):
OS Type & Version: Windows 10
Java/JDK version: openjdk-20.0.2
IDE version (IntelliJ IDEA or Android Studio): IntelliJ 2023.1.5
Describe the bug When using
@var
,@val
,@get
and@set
without parameter the resulting getter and/or setter is public by default. when you addPropOption.Private
orPropOption.Package
as an annotation parameter, the created method for the respective getter/setter will be private or package-private respectively. So far so good.However for
@get
,@set
and@var
, when usingPropOption.Public
orPropOption.Protected
, I get the following error:If manifold were to follow the java standard and make the getters and setters package-private by default, I would understand this error, but since manifold makes these public by default, this error seems incorrect.
Also, for
@val
I get a different error:Workaround Marking the field as public solves the issue for all 4 cases and still properly makes the field private after compilation, but this seems redundant, since this should have been the default with Manifold.
To Reproduce Steps to reproduce the behavior:
Expected behavior I expected the use of Public and Protected to work as well, with all 4 annotations.
Screenshots
Desktop (please complete the following information):
Additional context Code: https://gist.github.com/CC007/afde6311db82c4f57cf8b0496f34c471
PS: sorry for posting so many issues in one day 😅